-3

I am a beginner at programming and I have seen many posts talking about the difference between any two of them. But haven't seen a post that talks about the diffences between design principles, design patterns and algorithm. Can you please explain to me how these are different? Am I correct in saying that 'design principles' are like general set of rules for any programming...say creation of any software...'design patterns' are also like general rules but rules to tackle a particular problem that the software is built to solve...and 'algorithms' are much more concert steps to solve a perticular problem?

Also if you are giving negative points ..please do tell why you think this is a bad question. That can help too.

GRANZER
  • 355
  • 3
  • 13
  • I think that the main reason for the minuses is two, maybe threefold: First, the question is too broad - each of the topics you ask about has a plethora of books about it, so summing them up in a single question/answer is a bit of an overkill. Second, parts of the answer might be opinion based, since my understanding of a meaning behind design principles might be different than somenone elses. Also everyone might be assigning a different weight to the importance of for example design patterns. (Algorithms and design patterns are well defined though) – Shamis Jan 13 '21 at 10:48
  • Lastly you are asking for a comparison of a things that are hard to compare as they are from different categories. If I were to overshoot a little, your question is similar to something like: What is the difference between Physics, The table of physical equation for the high schools and the way to build these equations. A tad tricky one to answer ^^:-) – Shamis Jan 13 '21 at 10:52
  • One piece of advice for improving the question: any time you mention other posts (e.g. _I have seen many posts..._) you should link to those posts. Show what you've looked at and then explain what you don't understand in terms of those posts. If no research is shown (not just mentioned but shown) it's easy to assume there was no research. Hover over the downvote button and you'll see that's the first reason. – jaco0646 Jan 14 '21 at 01:05

1 Answers1

0

The short answer:

Go look up the books, study the topics. The answer will reveal itself in time.

The insufficient but not that short answer:

Design principles are guidelines that tell us how to think about the code. These are usually general, like: it is nice to structure the code in functions to improve readability etc. They most likely vary from a programmer to another as every one of us has a different wealth of experience and slightly different approach to tackling a problem. A result of applying a design principle can be something like a "functional programming" approach.

Design patterns are an attempt to standardize the solution for the most common design problems. Design principles given form if you would. You can imagine them like learning the opening moves in chess - when a chess player says "Queens gambit", every other decent chess player will know which sequence of moves that means. Unfortunately this approach has its limits - design patterns are fixed tools in an everchanging environment. So while it is definitely useful to study them and learn from them, they by itself rarely provide a sufficient solution to a real world problem. Unfortunately, they are quite often used as a fixed rule, which results in many poorly written programs - when you have a hammer(and powerful one to boot), you are likely to see everything as a nail.

Algorithm Is the easiest one to answer: https://en.wikipedia.org/wiki/Algorithm. Since it is well defined, there is not much of a room for an interpretation. Ye olde cookbook recipe.

To sum up: Design principles tell us, how to implement algorithms in a way that is readable for the humans while being readable, maintainable, extendable etc. Design patterns are one of the many attempts to standardize design principles, which might or might not have backfired, depending on a way you look at it.

Shamis
  • 2,544
  • 10
  • 16