There are many theories on how software should be developed, probably several for each programming language that exists. Some approaches go in and out of vogue, whereas the applicability of others greatly depends upon the language in use or the complexity of the application being written. This is why I was so happy to discover Scott Mattocks‘s work on what he calls “LUCID development“.
LUCID is an acronym that identifies five key qualities that any code you write should have. The code should:
- Log information
- include Unit tests
- be highly Configurable
- Isolate features
- be fully Documented
This is a nice, reasonable set of suggestions that do apply to most situations and in most languages.
The goal of LUCID development is to create code that’s easier to maintain and use in the real world. Good documentation is always a must, and helps anyone reviewing the code months or years after its initial development. When bugs occur, the logs and unit tests should make it easier to identify and fix those bugs. When changes need to be made to existing code, having that code be configurable and isolated helps expedite those changes and transitions.
Mattocks’s theories are explained in detail in his series, with plenty of code examples. An aspect of this approach that I also appreciate is how it scales well to the programmer’s level. Unlike implementing high-level OOP concepts such as SOLID, which requires quite a bit of knowledge and experience, LUCID can be used by the beginning and expert programmer alike. Most likely this was a complete accident, but the acronym breaks down nicely this way: beginners can start with the consonants–Log, Configurable, Documented–and move onto the vowels later on. In fact, you can take this a step further and suggest that beginners ought to start focusing on the consonants in reverse order:
- Great documentation
- Configuration
- Logging
And then move on to the vowels in reverse order:
- Get better at creating isolated code
- Start adding Unit tests
Again, this is just my angle on how new developers could start applying the LUCID concept.
I first met Scott Mattocks at the True North PHP conference in 2012. There he gave a great presentation on making your code behave like a great co-worker. That presentation’s title is “Recursive Software Development“, but it’s really about the qualities you’d expect your co-workers to have and that your code is truly your most important co-worker. Those desired qualities are the same as outlined in the LUCID blog series.
So when you have a few moments, check out the blog series and the presentation. There are some great best practices to be learned, regardless of your skill level or language preference.