Introduction to Design Principles
Having the technical knowledge to solve a problem programmatically is great. Technical knowledge alone, however, is not enough to ensure that you have solved the problem well. Even if the solution works, how flexible is the solution in accommodating slight variations or changes to the problem? How reusable is the code? Has the problem been solved in a manner that is efficient? For example, a solution which works, but takes a year to run is not much of a solution, even if the answer produced at the end of the year-long process is 100% correct.
This is where Design Principles come in to play. In this module, we will learn about some principles to keep in mind as we design functions, classes, and programs so that we can ensure good coding practices, and the production of efficient, reusable, flexible code.
Before we start, let's take a look at a tool we can use for conceptually designing our programs before we even write a single line of code. This tool is known as UML: Unified Modeling Language. It is very useful as we can produce technical solutions to problems very quickly using this diagramming technique, which can then be shared with other programmers and used as a template for producing code. We can also use UML for analysing our designs in terms of design principles and design patterns.