- 09.07.2017 at 3:23 am #4097
Васильев Владимир СергеевичKeymaster
This article explains in simple words why a professional programmer needs to use design patterns in his code, gives a clear explanation of what is a design pattern and why it should be used.
Before starting to talk about Design Patterns, let me ask you a simple question.
Have you ever invented the wheel? I think, that it happened to you for more than a dozen times in your life – when you had to invent something that has already existed for a long time. How does it feel?
I think you would agree that it feels like a waste of time at least. Or maybe even realizing that your own solution has much to be desired to compare it with the existing one.
Using the experience and developments of previous generations – is not an empty sound, it’s a way to save your time and other resources, both material and physical.
This principle is not only working about home staffs.
In programming, a lot of time is devoted to code optimization, from different points of view: readability, performance, quality of structural organization. This is called refactoring, which means that we optimize something that already exists. And it always means more time to work on the project, because modifying something is usually more difficult than creating it from scratch, when you decide on the structure and code style. In the latter case that will require minimum of modifications and corrections.
Requirements for projects have gone far beyond the classical FURPS (Functionality, Usability, Reliability, Performance, Supportability), and long ago. To be more precise, requirements for the project remained almost the same in general, but the code quality requirements have increased significantly.
The code that just fits the requirements in the list of functionality, is of no interest nowadays. Now the details of solutions take almost the first place. What does it include: neat design, including the smallest details, readability, reusability, flexibility, extensibility, performance, use of smart solutions in typical situations … this list can be long. But the point is – what knowledge you must have to ensure that your code meets all these requirements?
In fact, first you need to change your attitude to writing code. Taking needles and knitting a kilometer scarf does not mean you are a professional in knitting.
Likewise – just knowing some programming languages syntax and a pair of technologies – is not making you a professional developer in the modern world. You need to be a designer, an architect of the code you are writing, and thus possess the tools, which are necessary for this. And what are those tools? The answer is – Design Patterns.
Design Patterns are ready-for-use structural, architectural solutions applied at different levels (at the level of several methods, or the level of class, or a group of classes, or modules of the same application, or several projects working in tandem). I repeat once again – these solutions are ready for use. Therefore you no longer need to reinvent the wheel.
You will need to spend some time getting to know Design patterns, to understand their essence, to learn to see in what situation which pattern is appropriate to use. And you will also need to learn to be moderate about using them.
And after that you will have a powerful development tool, which will present your code in a favorable light, and thus will confirm your status of a professional in software development.
There is one more point in using Design Patterns – using concepts familiar to all participants of the discussion. It speeds up and simplifies the process of information exchange. In other words – it’s using names of Design Patterns as termines. And each of those termines – reveals the structure and the idea of a pattern. It’s much easier to name a pattern than to try to explain how to organize the interaction between classes in each particular situation and explain why. All this information is already included in the short termine that you use to explain it.
So it will take much less time explaining to colleagues on the project, what you mean. And they will understand you much faster and easier if you manipulate the names that mean existing solutions.
So I advise you to master a great development tool such as Design Patterns and use it for your own good while working on your projects.
You must be logged in to reply to this topic.