When designing in Object Oriented Programming (OOP) the question I always ask myself when trying to figure out where some piece of code should go is, "Who does this behavior belong to?". If our class names are nouns, such as Orders, Books, ProductColors…
Complexity is only Simplicity x 1000 -- A mathematician friend once told me that. The idea struck a chord with me and has stuck with me ever since. Everything in this world is complex. When we design computer systems our goals should be to encapsulate that…
So we're all computer programmers, but what makes you successful? What makes you an excellent contributor to your team or company? I discovered the importance of these traits little by little over the years. They are progressively more important as you move…
You know you're doing a great job when, adding new functionality to a code base, and you wind up removing more code then you've added. Less is More. I once heard boast a programmer that he'd written million lines of C code. That seemed undesirable to me…
Let's standardize how we write SQL. What joy. Rarely, have I seen consistency in how SQL is formatted, and often it is not even considered. Here is the standard I use which makes it easy to read both simple and complex queries. Here is an example: select b.id…
I believe programs should be like gardens. They should be lovely to see. Gardens are things we walk around in and return to often. Gardens are things we wish to spend time in with others - to relax in and enjoy its beauty. If we strive to make your programming…
A simple rule to help improve convention and maintainability: Camelcasing should be used when dealing with Objects, Everything else should use underscores. Objects Class definitions should be CapCase Objects should be mixedCase Class Methods should be…
Defensive programming is like defensive driving: Anticipate everything that might go wrong. If a function is passed an Id to a database table, do not assume that it is a valid Id, or an integer, or even that it has a value. What is most important in defensive…
Whether building a new system, or trying to untangle some untenable rats nest of code -- One should have an image of the ideal state in their mind. If we draw up the best plan we can, thinking in terms of the perfect - regardless of its immediate feasibility -…
What is the benefit of using a framework like Ruby-on-Rails, Pylons or Drupal? Simply put, it helps us start and develop code from nothing quickly. But it does not have long lasting staying power. If you plan to be using the system for years to come - the…
A Pull Request, which might more sensibly be called a Merge Request, is the act of a someone asking another to merge his or her code into theirs. It is all so civil. It solves an age old problem of how to do code review, in a more effective less disruptive…
The Model-View-Controller Pattern ( MVC ) is not the only game in town. In fact it is awkward and cumbersome in some cases. MVC is a D esign Pattern , and Design Patterns show us how to solve common problems with common solutions. However we should not just…
What should we call it? Call it whatever you like. I hear that a lot. As coders and builders of systems, we should take the time needed to come up with the best names for the systems , databases , tables , columns , filenames , modules , classes , methods …
A stitch in time saves nine, is a fundamental principals we should use to write code and build systems. It might be said, a stitch in time saves you from being stuck forever with unruly software. People just want to get the job done. But any small mistake or…
So often I hear tech folks talking about some implementation as being better than another because "It is more efficient ". Efficient? Efficient for who? The computer? Are we shaving milliseconds off processing time? That's ridiculous. We should be in the…
$What is $easier to $read? {A $document of $commands in a $pseudo $English $language $strewed with ($dollar $sign $symbols ($$), $French $Braces ({), and $semi-colons)? Or a $document $without all $that?} What is easier to read? A document of commands in a…
Ask yourself, is it Elegant? Is it a thing of beauty? If this is some important piece of code that others will be using then it should be written well. I read once in an old programming book, "Born to Code in C", that first you need to make it work, then make…