scribble

LarsBarkman.com

Blog Whoami Twitter GitHub Pinterest LinkedIn GUARDIAN RSS

08 Sep 2014
My Current Programming Philosophy

An articulated and communicated programming philosophy is fundamental to continuously deliver quality in “software development”.

It’s also very important to have a personal philosophy as a beacon when navigating “dangerous waters” in projects and as a filter for marketing buzzwords/new products that is supposed to make everything better…

The word philosophy could be replaced by principles/qualities and programming with architecture/development without changing the outcome. I personally like the softer and more artisan feel of Unix philosophy then the more business oriented Key Principles of Software Architecture, that’s the reason I call this ”Programming Philosophy” rather then “Principles…”.

It’s a number of years since I was a professional programmer but strangely I appreciate good craftsmanship from programmers much more as an architect then I ever did as a developer…

So what do I base my principles on (besides the experience I gained myself)?

  • The book “The Practice of Programming” written by B.W. Kernighan and R. Pike gives a number of rules (rather than philosophy) but it is nevertheless a very good summary of the basic principles of programming (Summary of the rules).
  • Microsoft has a number of very good principles (Microsoft Developer Network).
  • Eric Raymond’s 17 Unix rules (Wikipedia)
  • Mike Gancarz’s book “Linux and the Unix Philosophy”(PDF, HTML)
  • Doug McIlroy (Wikipedia), the man behind (among other things) Unix pipelines have said many very sound things related to writing code for Unix, the principles, however, is universally applicable regardless of operating system.
  • Seven Principles of Software Development
  • And been inspired by many more

So when I now summarize my programming philosophy, I can proudly quote Sir Isaac Newton > “If I have seen further it is by standing on the shoulders of giants” > > - Sir Isaac Newton</blockquote>

(I have tried to link the more famous principles if you would like to read more about them)

  • Designing the solution with this in mind…
    • Separation of concerns
    • Principle of Least Knowledge
    • Don’t Repeat Yourself (DRY)
    • Do not duplicate functionality within an application
    • Prefer composition to inheritance
    • Be explicit about how layers communicate with each other
    • Use abstraction to implement loose coupling between layers
    • A component or an object should not rely on internal details of other components or objects
    • Do not overload the functionality of a component
    • Understand how components will communicate with each other
    • Define a clear contract for components
    • Premature optimization is the root of all evil”
    • with minimal upfront design
    • avoid captive user interfaces
    • design their programs to be flexible and open
    • design for the future by making their protocols extensible
    • design for visibility and discoverability by writing in a way that their thought process can lucidly be seen by future developers
    • design robust programs by designing for transparency and discoverability
    • design programs that fail in a manner that is easy to localize and diagnose or in other words “fail noisily”
  • Build with this in mind…
    • prototype as soon as possible
    • use automated QA techniques during development to maintain system quality
  • BWrite code that…
  • Programmers should…
    • build a program out of simple parts connected by well defined interfaces
    • write programs as if the most important communication is to the developer
    • write programs that can communicate easily with other programs
    • choose to make data more complicated rather than the procedural logic of the program when faced with the choice
    • value developer time over machine time, because machine cycles in 2014 are relatively inexpensive compared to prices in the 1970s

    If you think that there is something I missed or just want to get in touch, please contact me on Twitter @larsbarkman

Til next time,
Lars

scribble

Blog Whoami Twitter GitHub Pinterest LinkedIn GUARDIAN RSS