What makes computer science amazing

03 Dec 2020

The Bread and Butter of Computer Science

The thing that makes computer science unique, and arguably its best feature is code reusability. The ability to come up with a general solution to a problem and specifically apply it allows for future, similar problems to be solved immediately. Code reusability is a feature derived from design patterns. Design patterns are essentially one further level of abstraction above code reusability. Instead of being a solution to a problem in code, they are a description of a problem, and a description of a way to solve it. While not originating in computer science (the idea comes from architecture), the concept of design patterns has become a core component of it, and such solutions are often applied before an individual learns that they are design patterns.

The concept has evolved since its introduction. While many design patterns show optimal solutions to problems, some design patterns exist to show poor ways to solve problems, like using a singleton. While they may be solutions to the problems, they have at least one element to them that makes them either bad to use, for example the use of a global variable, or inefficient compared to a more elegant solution.

When and Where are they Used

As mentioned before, it is possible for individuals to use design patterns before they know what a design pattern is. I myself only learned the concept last week but I have applied them throughout my time programming. Throughout academia, computer science professors will impart onto students a way of writing certain code. In pretty much every class I’ve taken, professors have stressed the idea that while there are many ways to solve a problem, some are better than others. In fact there’s an entire class on algorithms taught at this university, the goal to impart good algorithm design skills. In every case, the professors are trying to impart good design patterns to the students. In many cases, there is some component of the class (usually the assignments, but in some cases group projects) which acts as the problem component of the pattern, and the exercise leads students through the solution part of the pattern. This way students learn good design patterns before they apply them or search for solutions on the internet, which may or may not work, or may work poorly. Truly, design patterns can and will be used in any computer science project of reasonable size.