Into the Void


Midnight Freedom Theory

Posted in Life by Scott Baldwin on the April 26th, 2006

Last night it became clear… The story was about me against them, and how I won because I had nothing to lose.

The Art of Software Design

Posted in Tech by Scott Baldwin on the April 2nd, 2006

I’ve written many programs in many different languages, from PHP/MySQL Web applications to multi-threaded servers in C++, but one thing never changed: the importance of good design.  Every experienced developer knows how imperative it is to have a clean application framework.  Creating a clean, scalable framework however can be a challenging task.  Fortunately, there exists a near-endless arsenal of languages, toolkits, APIs, and IDEs, as well as countless design patterns and methodologies to aid us in designing and implementing quality software.

I think truly recognizing the importance of good design can only happen through real-world programming experience.  Most programming courses in college will briefly mention design paradigms (such as Object Orientation), and then move on to syntax, APIs, algorithms, etc.  To make matters worse, the programming assignments (specifications) are normally so trivial and laid-out that it frees students from design challenges that exist in developing real-world applications.  Therefore, students must take the initiative to develop real-world applications outside of class.  By doing so, I have learned a lot about the importance of good design through many lessons and mistakes.  I have listed some important ways to achieve better program design and results below.

1) If you’re copying and pasting your own code, then stop!  Creating reusable software and eliminating redundancy is crucial to good design.  If you can extract any functionality from something, then do it (you can always declare it inline if you’re worried about performance).  By duplicating the code, you make it a nightmare to maintain.  Eventually, you’ll get tired of updating 10 sections of code just to change one thing, knowing that if you miss one it will cause run-time anomalies!

2) For big applications, use an Object Oriented Programming Language such as C++ or Java.  Big code bases will become extremely difficult to manage unless you tame them with the power of OOP.  The four frequently cited advantages of using an OOP language are inheritance, abstraction, encapsulation, and polymorphism.  All four of these capabilities are tremendously beneficial!  Inheritance makes it possible to create a hierarchy of functionality that cascades from the top to the bottom (direction depends on how you look at it), useful for creating reusable software components.  Abstraction lets you treat complex things as simpler things through modeling.  Encapsulation hides implementation details that would otherwise be distracting.  Last but not least, polymorphism makes dynamic programming simple through the magic of virtual methods.  These capabilities are not just great in theory… you will learn to appreciate them when you have to develop an application with 50,000 lines of code or more.

3) Take full advantage of your environment’s debugger!  It seems like many students do not understand basic debugging concepts such as memory watching, stack inspection, breakpoins, and backtracing.  These tools are invaluable so use them!… it’s well worth the initial learning curve!

4) Read the documentation!  For whatever language you choose, learn the APIs, frameworks, toolkits, and libraries at your disposal.  There is no reason to reinvent the wheel unless you absolutely have to!  Plus, odds are your “wheels” will not be as fully tested or as fast as the ones provided by your environment.  For portability purposes, the more standard the libraries are the better.

5) By properly separating the functionality of your software into cohesive units (such as Classes), you will achieve clean interfaces.  Clean interfaces will provide simple interaction between components (Classes) within your framework.  More importantly, maintaining small, clean, loosely-coupled interfaces will make your software easy to extend forever.

In conclusion, make reusable components with clean interfaces that take full advantage of your development platform, language, and libraries.  And remember, software design is an art that takes time to master.  Never give up, because you’re only bound to get better.