Foundations

05 Dec 2017

When building a house, what do you start with? The walls? The roof? The right answer is the foundation. The foundation is what holds the house together. It’s usually the same depending on the overall design of the house. The foundation alone can’t be called a house, but it starts the building process. There are different types of foundations for different types of houses. For example the structural integrity of a foundation for a mansion is not the same as one for a cottage. The foundation can be thought of as a general solution to a software problem. It serves as a foundation to solve different problems. It’s a repeatable solution to a commonly occurring problem in software design. More specifically design patterns.

When writing code, I like to think of it like creating a structure. You first start with the foundation, then build upon that to solve the problem. The initial part of writing code is always the hardest part. As you read the problem, a million possible solutions comes rushing to your head and you don’t know where to start. What base do you use? Is one better than the other? Picking the right foundation will determine if you will be able to solve the problem. You don’t want to use a one story house foundation for a two story house. The same way foundations are used as a base for a house, I use design patterns to structure my code. I start with the design pattern, then build upon that to solve the problem in front of me.

In conclusion, design patterns are very important in software engineering. Why reinvent the wheel? The design pattern might not solve the problem right away, but it can be used as a foundation to build your code on. Picking the right base is crucial to the solution, so you must think about the problem carefully. Picking the wrong foundation can have catastrophic consequences.