<p>I came out of college with a fresh CS degree in 1989, to find that my colleagues were on average very much older than me (obviously), had by-and-large never heard any of the fancy "structured programming" lingo that was taught in my software engineering course at the time, and in fact mostly didn't even have CS degrees themselves.</p>

<p>Three decades later, the shoe's on the other foot. Our fresh-out-of-school new hires like to talk a lot in pattern lingo that didn't exist in the 1980s, and most of which honestly doesn't need to exist today. 20 years from now it will be a new fad, with new lingo.</p>

<p>So no, I wouldn't worry about it too much. Other than your younger co-workers, not having memorized the pattern lingo isn't going to hamstring you in the field a whole lot.</p>

<p>But are there fundamental things that come along with Design Patterns that you really need to know as a professional? I'd say the results there are mixed. Let's look at the tables from the <a href="https://en.wikipedia.org/wiki/Software_design_pattern#Classification_and_list" rel="nofollow noreferrer">Wikipedia page on patterns</a>.</p>

<p>In the "Concurrency Patterns" table, pretty much everything in there is standard concurrency programming, that I learned in school 30 years about without benefit of the GoF lingo. Outside of that, I see about six things in all the other tables that I can say I've used over the years, when needed, but it's all just pedestrian stuff. If you have half a brain, you'd figure that out yourself if you ever need to. However, there are two exceptions: <a href="https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization" rel="nofollow noreferrer">RAII</a> and Singletons.</p>

<p>RAII is such a powerful concept and central concept, that it really should be taught. The peace of mind from not having to worry about dynamic resource lifetimes is one of the real game-changers that happened during my career. However, I'm not sure I'd call it a "pattern". Design Patterns and Code Complete seem to agree, because they don't include it. This should definitely be taught, but I don't think you need the overall "pattern" structure around it.</p>

<p>Singletons are just an object-oriented hack to get yourself globals, and <a href="https://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons">should almost never be used</a>. If they are taught at all in school, it should be as an anti-pattern to avoid, along with gotos. Yet both <em><a href="http://en.wikipedia.org/wiki/Design_Patterns" rel="nofollow noreferrer">Design Patterns</a></em> and <em><a href="https://en.wikipedia.org/wiki/Code_Complete" rel="nofollow noreferrer">Code Complete</a></em> positively teach them.</p>

<p>So no, I wouldn't worry about your software engineering class not being pattern-focused. You can get by just fine without them.</p>

CC BY-SA 4.0
2019-02-19T15:54:22.513Z
Your general advice (don't worry about it) is sound. But the specifics are deeply flawed. Don't criticize patterns because they don't do anything _new_. That is an intended characteristic of patterns. _Capture good practice in an easily transferrable way_. They are explicitly NOT about invention. You are wrong specifically about singleton (as is much of the linked post). There are applications in which singletons are required. Don't criticize them just because some people misuse them badly. The are _not_ a hack to get globals. They are needed when _logically_ there is only one instance.
Buffy
CC BY-SA 4.0
2019-02-19T16:25:21.817Z
@Buffy - Heh. Disagreeing with an accepted SO post that has over a **thousand** upvotes (and only 25 down). Ballsy that. You're horribly wrong, but I give you points for taking a stand. I'll tell you that we found out how right that post was the hard way. But some of us only learn that way.
T.E.D.
CC BY-SA 4.0
2019-02-19T16:32:50.723Z
On the other hand, I've been a member of the patterns community since GOF was issued. I'm also one of the few to know that GOF wasn't actually the _first_ patterns book, though it was the first to use the name in such a public way. The "wisdom of crowds" sometimes isn't, of course.
Buffy
CC BY-SA 4.0
2019-02-19T16:43:10.737Z
@Buffy - However, in this case the crowd is spot on. Singletons destroy testability and make future design tweaks really problematic for no good reason. If you only want one in your current design, [only make one](https://codeahoy.com/2016/05/27/avoid-singletons-to-write-testable-code/). Problem solved. And now when you need to write unit tests, or discover three years from now that you need two copies of the entire application running at once, its not a gigantic self-inflicted redesign problem.
T.E.D.
CC BY-SA 4.0
2019-02-19T16:52:30.163Z
Patterns capture design decisions for the future as well as the present. Yes, I only create one. Some future maintainer might not _remember_ all of the design decisions previously made. So, in good software, we try to capture those decisions so that they aren't easy to subvert - especially by accident. Enums do a similar sort of thing. Build your software do that you don't need to keep every decision in your head perpetually and expect that others will have the same understanding.
Buffy
CC BY-SA 4.0
2019-02-19T22:31:14.313Z
Design Patterns are simply a common set of names for practices we all figured out ourselves at some point (or would figure out once we needed them).  If I called my thing a singleton and you called it a controlled-instance we wouldn't make much headway in conversation. They also tend to show implementation details you may not have thought of.  You can design without them, but if you are working on a team you will have difficulty communicating.  If you haven't at least skimmed the design patterns, don't call yourself a professional--same if you rely on them exclusively.
Bill K
CC BY-SA 4.0
2019-02-20T01:01:07.770Z
@BillK The bulk of the last comment is worthy. The closer, however, is not. I was a "professional" long before GoF 'Patterns' ( or C++) existed. I have still not read that book, or any related material. I also do not believe I need to because I do not need to reduce my conversations to cliches or shared inaccurate nomenclature. Don't tell me which 'pattern' you code _almost_ implements, explain what it does and how you can prove it does it correctly.
Gypsy Spellweaver
CC BY-SA 4.0
2019-02-20T01:44:18.097Z
@GypsySpellweaver I suggest you at least skim it.  It's asked in enough interview questions today that you are severely restricting your job search if you don't.  I've also coded since the 80's, before patterns existed and when I read the book I recognized nearly all the patterns as ones I've created at one point or another in my career.  It's not going to teach you how to code, just how to communicate more efficiently.  My point above was that resisting knowledge like this is not professional.  A professional programmer is constantly improving himself with all the tools he can find.
Bill K
CC BY-SA 4.0
2019-03-14T10:51:40.320Z
In @Buffy's defence, he's not being so "ballsy".  The post you linked to supports his position more than yours once you delve into the comments.  Even the author of said post asserts that they are needed from time to time: https://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons#comment2667126_138012.
Ben I.
CC BY-SA 4.0
2019-03-14T12:58:51.160Z
@BenI. - No, he said he *uses* them from time to time, not that they are needed. Being a purely a defensive measure (over simply only creating one of the object in question), they are never *needed*.
T.E.D.
CC BY-SA 4.0
2019-03-14T16:22:01.510Z
Fair enough.  And, in your defense, you also didn't say to never use them, you said "almost never".   Everything has its time and place.  :)
Ben I.
CC BY-SA 4.0
2019-02-19T15:40:17.277Z
2019-03-13T23:05:42.937Z
2019-03-13T23:05:42.937Z
T.E.D.
<p>There isn't that much to "Teach" about design patterns.  You should be able to skim one of the books in a few hours and possibly try to implement a few yourself if they confuse you.</p>

<p>For the most part design patterns make up for deficiencies in languages or patterns.  For instance, in OO it is pretty much impossible to connect from two different "Entry Point" objects to a shared object, so we use the singleton pattern.  A better solution is to use Spring (Which is more like enhancing your language to solve the problem) and then we no longer need a Singleton "Design Pattern".</p>

<p>If you were using a perfect programming language you shouldn't honestly NEED any patterns (Any pattern in your code is, in essence, not DRY).  Design patterns are used for something that cannot be directly expressed in your language and is either too simple or too messy to put into a library.</p>

<p>We don't have a perfect language so we still make use of patterns. Reading about patterns isn't difficult and will give you a common language to use with your team.</p>

<p>I suppose if I were teaching computer science I'd require a pattern book and suggest it be read, maybe test on it, but I don't think I'd waste much class time on it.</p>

CC BY-SA 4.0
2019-02-19T22:44:33.823Z
2019-02-20T00:10:58.343Z
2019-02-20T00:10:58.343Z
Bill K
<p>The vocabulary of computer science is not as well established as the vocabulary of mathematics.  Many words have different and contradictory meanings in different contexts, and it would thus be common for different people to describe some particular concept using seemingly-unrelated words, or use the same words to describe unrelated concepts.</p>

<p>Certain books have become sufficiently popular that many people have adopted the vocabulary used thereby.  The notion that code to accomplish similar tasks would often be written in similar fashion precedes by decades any attempt to formally recognize any particular set of Design Patterns.</p>

<p>Although it's useful for people to have a consistent vocabulary that can concisely describe certain common patterns, there's nothing particularly "magic" about it.  Being able to recognize why it is useful for certain kinds of code to accommodate certain combinations of actions is more important than knowing that a popular book refers to some combination of abilities as the "Woozle Pattern".</p>

CC BY-SA 4.0
2019-02-18T18:05:35.697Z
2019-02-18T18:05:35.697Z
supercat
<p>Computer Science and Software Engineering are very related but also different disciplines. When I went through my degree (ABET accredited program, US) Software Engineering was an elective (as it is <em>absolutely</em> not necessary to be a good computer scientist - though some may disagree), and in that class you learned design patterns. We would joke these were the "trade school" electives for CS graduates because if you took them you were probably going straight to industry. I took them, I went straight into industry. I took 4 programming-oriented classes in total. Two in the beginning to get your familar with the common language, and two at the end (the SE classes). Everything in the middle was pen and paper mathematics, algorithms, data structures, and compilers. Yes, many things were <em>implemented</em> in software. But it was not the <em>central theme</em> of the class. To me, design patterns are trivia that you can pick up on the job. A class is just a nice way to get started. I learned everything being a professional software engineer. In hindsight, the classes were outdated.</p>

<p>You are also vastly overestimating the complexity of academic code. Yes, sometimes it can get very hairy but take a stroll around arxiv. Can you name 10 papers that would be improved by knowing the Gang of Four book cover to cover? Doubtful. Proof of concept code is exactly that - it's a proof of concept. It's up to software engineers to grok it and make it beautiful.</p>

<p>There is so much more to Computer Science than software engineering. There are so many sub fields and software engineering is just one very very tiny one. Equating software engineering with the entire field of Computer Science is more-or-less the result of code schools being so prevalent (in my opinion). We (as a field) should really work to dispel this myth.</p>

CC BY-SA 4.0
2019-05-10T14:56:33.933Z
"Proof of concept code is exactly that - it's a proof of concept. It's up to software engineers to grok it and make it beautiful." If only I could convince our R&D department of that!
Rob Crawford
CC BY-SA 4.0
2019-02-20T01:20:11.433Z
2019-02-20T01:20:11.433Z
CL40
<p>I wouldn't worry to much about it. My CS program at Arizona State University (circa 2010) only had Design Patters as an elective class. I knew plenty of people who never took it.</p>

<p>I think this comes down to the difference between "Computer Science" and "Software Engineering". </p>

<p>Computer Science focuses more on the theoretical side of things (algorithms, mathematical models of computing, how operating systems and compilers work, etc). It's stuff you don't directly use very often, but gives you the foundation to do any type computer work you want to do.</p>

<p>Software Engineering, on the other hand, is "how to make stuff". It answers questions of "How do I design the software I'm creating?", "How can teams of programmers best work together?", "How can engineering teams best work with non-engineers?", etc. It's more about the big picture view of how to make software.</p>

<p>CS programs generally don't spend much time on all the engineering stuff. There are so many things to learn about programming and software engineering that there is no way any university program could cover a sizable fraction of it. So they focus on the theory that will help you learn the rest on your own or as you work in industry.</p>

<p>I'll say this much about my experience: Even though I did take the design patterns elective at my school, it was only quick intro. It took years working before I felt like I started to get a handle of why, when, and how to use them well. And I still feel like I have a long way to go.</p>

<p>So as I said, don't worry to much about it. Get yourself a decent reference book, skim through it just to get a feel for what patterns are out there, and then be mindful of them as you go to work as an engineer. You'll figure it out as you go along.</p>

CC BY-SA 4.0
2019-02-19T21:39:28.853Z
It's just possible that I know the person who taught your course. A friend taught there about then and was influential in the patterns community. But today, I wouldn't make it a separate course. You would just learn the techniques in CS1 CS2 while learning to program, assuming it was in an OO language. A real OO design course would normally be at a higher level than the GOF patterns. There are real architectural patterns of course.
Buffy
CC BY-SA 4.0
2019-02-19T22:20:49.457Z
@Buffy - Our design patterns elective was a 400 level coarse. Our professor was actually a software architect at Disney who flew down once a week just to teach the one class.
Miles B.
CC BY-SA 4.0
2019-02-19T20:21:36.103Z
2019-02-19T20:21:36.103Z
Miles B.
<p>There is more to a CS degree than programming and more to programming than Design Patterns. I'm actually an expert in such things and have designed and published a few as a committed member of the patterns community. If I were teaching you programming in some object-oriented language you would certainly learn about and use many such patterns, but you might never hear the names, just the usage as good ways to write programs in a certain set of languages. </p>

<p>However, I have a friend, also in the community, who is well known and has designed many things fundamental to areas of programming languages who doesn't use the standard design patterns you are probably thinking of at all. The reason is that he programs in LISP and CLOS, not Java and C++. His informed opinion about the design patterns is that they are merely corrections for flaws in certain languages, primarily C++. Many of the kinds of things that design patterns accomplish in C++ are done in more natural ways within Common Lisp itself without needing any such mental tricks. </p>

<p>So, it may well be that your curriculum is flawed, but not teaching the patters in the <em>Gang of Four</em> book is not the only indicator. (Some of those authors are friends of mine, in fact). </p>

<p>Moreover, there is more (much more) to CS than programming. Have you learned data structures and algorithms? Have you learned architecture and databases? Have you learned data communications and concurrency? Have you learned to work in teams on large projects? Have you learned to think abstractly and to decompose problems and compose solutions? Those are vitally important too. </p>

CC BY-SA 4.0
2019-02-17T04:21:26.183Z
The last paragraph here doesn't seem to make a lot of sense as to its necessity here. The OP is not saying that a good CS program should _only_ include "design patterns", but that for _missing_ that _one_ component, it is _worse off_ (not _a failure_, but _reduced_, i.e. _incrementally_, in quality - in fact the words "reduce the quality" were the exact ones used) than a program that would have included it. Just like one skimping on algorithms, or on any of the other components you mentioned there, would be a worse off program than one that did not skimp.
The_Sympathizer
CC BY-SA 4.0
2019-02-17T04:24:36.437Z
Or in simple terms, a CS program must include much more than _just_ design patterns, but if you take a program that is '_just_' that "much more", and compare it to another program that is 'just' that "much more" _plus_ design patterns, it would seem the latter would be a better/more comprehensive program than the former. Moreover, especially if the latter program teaches you the _thinking_ behind the patterns, which I'd think more important than the specifics themselves, as that is how you will truly understand _why_ they are used and _when_ to use them.
The_Sympathizer
CC BY-SA 4.0
2019-02-17T08:24:17.553Z
As a specific example, one of the more famous patterns is a singleton. If you use java or the likes, this requires a particular combination of static pointers and private constructors to do properly. However if you are working with the language Scala, singleton is built in. You make a class as usual but call it an object rather than a class and everything works. This is why it is more important to learn to think about concepts like "I want this exactly once" than the detail in a particular language. Barring experience, a good CS degree would leave you equally prepared to learn any language.
Josiah
CC BY-SA 4.0
2019-02-17T12:27:50.473Z
It would be amazing if a course taught both the OOP design patterns and the "missing" features that they replace (e.g. visitor pattern <--> double or multiple dispatch, etc).
Theodoros Chatzigiannakis
CC BY-SA 4.0
2019-02-17T16:34:30.277Z
There are lots of things that could be taught in addition to the existing curriculum, but at some point we'd have to acknowledge that we need more time to do so. University gives you the theoretical background to read up on the things that didn't fit.
Simon Richter
CC BY-SA 4.0
2019-02-17T21:07:43.943Z
Not just "primarily" C++. Gang of Four design patterns are inextricably linked to C++. Whilst some of the concepts (e.g. multiple dispatch) are common across OO architectures, the Gang of Four patterns are purely C++ *implementations* of those higher concepts. It's notable that the patterns only cover features absent from C++, and do not start from the elemental features of OO such as member data and functions.
Graham
CC BY-SA 4.0
2019-02-19T03:46:58.003Z
@Josiah : True, but to me, in this case, "design patterns" _is_ about concepts. It's not merely about how they can be implemented - and even then, learning how they are gives you an idea of what is going on under the hood even if you're using a language where that you don't have to actually write that implementation yourself as it's provided for you. If you don't know what a singleton _is_ , when it's useful, when it should _not_ be used, _why_ that is, and so forth, then it doesn't matter whether the language has it or not. And _that_ , imo, is what a good DP course should cover.
The_Sympathizer
CC BY-SA 4.0
2019-02-19T20:47:36.237Z
@The_Sympathizer I feel like that would be more of a "Design" class rather than a "Design Patterns" and said "Design Patterns" class would be more applicable to software engineering than computer science.
Jake
CC BY-SA 4.0
2019-02-20T20:14:21.840Z
Re:"...Corrections for flaws....Many of the kinds of things that design patterns accomplish...in more natural ways within Common Lisp...".  Those are such pointless comments. Many kinds of things can be accomplished more naturally in C++ than Lisp because of flaws in Lisp. However, Lisp programmer's learn tricks to work around and implement those things. IOW, they use design patterns whether they want to call them that or not. At the time the Design Patterns book came out, C++ was the overwhelming OO'ish language of choice. Thus, they are obviously more applicable to the C-family of languages.
Dunk
CC BY-SA 4.0
2019-02-22T22:22:31.473Z
Yes, as I have told some students who complained about abstract concepts in their degree, "If you just wanted to learn to code you could have gone to a training course."
Artelius
CC BY-SA 4.0
2019-02-23T14:07:22.220Z
At my university I learned that the advantage of knowing the names of the design patterns is that you can communicate them easily to fellow team members. This wouldn't be possible if you don't know their names.
Sandro
CC BY-SA 4.0
2019-02-16T20:03:55.423Z
2019-02-16T20:03:55.423Z
Buffy
<p>Buffy's answer perfectly addresses your question about design patterns. I would just like to add a bit of perspective about CS curricula in general.</p>

<p>Computer Science (CS) is very young compared to other scientific disciplines. For example maths or biology are strongly structured disciplines which rely on a quite well defined corpus of must-know basics. Of course these fields evolve, but the standard undergrad curriculum is not very different from what it was 20 years ago. On the contrary, CS is a fast evolving discipline and it is very different from what it was 20 years ago. Of course there are some broadly accepted topics, but there is no clear consensus about what a CS curriculum should contain. This is why different institutions might provide students with a significantly different background, but that doesn't necessarily mean that one is better than the other. It's important to keep in mind that a good CS curriculum is not one which provides students with the knowledge of their time, but one which prepares them to adapt and acquire new knowledge all along their professional career.</p>

CC BY-SA 4.0
2019-02-17T00:41:40.130Z
+1 especially for the last sentence. I think programming will change enough to make design patterns obsolete in much less than the 40 to 50 years of a human career. Knowing how to learn and adjust to changes will go on being useful.
Patricia Shanahan
CC BY-SA 4.0
2019-02-18T13:53:24.173Z
To be fair, there's plenty of university courses that are also evolving very quickly (e.g. chemical engineering) that handle it better. To me, it (sadly) seems that many CS courses are done just for the form, rather than the essence - it's important to have a CS course, so we have a CS course. It doesn't have any real purpose, you see, but... It's also disturbingly common to see people who have no real-world experience teach various aspects of CS. It reminds me of Feynman's famous reflection on the quality of Brazilian university education back in the day :)
Luaan
CC BY-SA 4.0
2019-02-18T13:55:38.400Z
Even worse, many of the things that are being touted as the best and brightest today are things that were developed decades ago. The good CS courses didn't have to change any of the fundamentals, because the fundamentals didn't change since the first ideas of electronic computers. Only the details change (as important as those details are, mind you). The only courses that need to change much are those that are either *actually* bleeding edge, or were more concerned with day-to-day practicalities rather than the actual science (for better *and* worse, mind you).
Luaan
CC BY-SA 4.0
2019-02-17T00:25:34.407Z
2019-02-17T00:25:34.407Z
Erwan
<p>In general, a good education is one that teaches you to think. A good computer science education isn’t one that teaches you any specific language or technique but one that exposes you to many different concepts such as algorithms and data stuctures, as well as theories such as functional, logical programming, and objected-oriented programming, and relational database theory. At the end of it, you should be able to teach yourself new languages and tools, and pick up new paradigms.</p>

<p>There are some basics that I would expect every computer science education to include, such as at least one assembly language, an understanding of Turing machines, algorithmic complexity, but design patterns isn’t one of those.</p>

<p>I do see it as a missed opportunity though: design patterns could be covered in one lesson as part of a course on object-oriented design.</p>

CC BY-SA 4.0
2019-02-17T13:40:25.343Z
Your last statement is problematic. I could certainly "mention" them in one lesson, and I might be able to "cover" them. But I wouldn't be able to actually _teach_ them. Maybe that is the level of discussion that the OP is complaining about.
Buffy
CC BY-SA 4.0
2019-02-17T12:37:47.453Z
2019-02-17T12:37:47.453Z
Colin 't Hart
<p>Since Buffy already gave such a good answer, I will post here my experience with an advanced course that focused on OOP and Design Patterns taken at a very prestigious Brazilian university.</p>

<p>The thing is, teaching Design Patterns is not easy. Remember that the GoF book was written as a compilation of the author's many years of experience in complex projects. Each pattern is proposed as an answer to problems that arise on certain situations. However, most students have negligible experience during college and have never experienced the difficulties described in the book. So you end up with a course that answers a lot of questions that were never asked in situations that are new to most students. In my case this took form of long expositions of patterns, their motivations and shallow examples of use. Many students slept during class, memorized the patterns for the exam, got reasonably good grades and surely forgot everything afterwards. After an entire course of OOP and Patterns, most students were far from experts in patterns and I suspect they would remember very few patterns, if any at all, a month after the course. </p>

CC BY-SA 4.0
2019-02-24T22:36:47.890Z
The GoF book is also more a "catalogue" of patterns, whereas correctly organized, patterns should come in the form of a *pattern language*. A lot of people seem to use the GoF book as a recipe for designing systems, which it is not. It is a catalogue of patterns where you can look up a pattern when you already know you need it. For discovering which patterns you need, you need a pattern language.
Jörg W Mittag
CC BY-SA 4.0
2019-02-26T11:58:14.237Z
@JörgWMittag makes a good point. The GoF book is not a textbook and it is by no means didactic. Pretending it is written for beginners and using it in undergraduate-level courses is not very good teaching, IMHO.
igordsm
CC BY-SA 4.0
2019-02-17T23:51:50.733Z
2019-02-17T23:51:50.733Z
igordsm
<p>It has been well known for decades by anyone coming out of University that, as you say, <em>"the problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern"</em>. And it has been well known for almost as long that this claim is wrong.</p>

<p>When you have a problem, you come up with a way to solve it that suits that problem and also the surrounding context. Then, if you want to describe your solution, you can find some terms/names for it &mdash; sometimes, there is already a name for the solution, so you can just use that name.</p>

<p>What you don't do is look at a problem and say "I know, I'll use the visitor pattern" just because it's a thing that has a name. That is an arse-backwards way to approach problem solving. You might utter that phrase out loud if you've concluded that the appropriate solution indeed does look like the visitor pattern, quite by chance.</p>

<p><strong>Design patterns are a descriptive tool, not a problem-solving tool.</strong></p>

<p>It is unusual for a University to <em>not</em> make this error, and you've mistaken it for an omission. It is possible that it is an omission. If so, I'd say it's a fortunate one.</p>

<p>I would have hoped, however, that your professor would at least pay lip service to design patterns because &mdash; rightly or wrongly &mdash; you will encounter loads of people in industry who treat design patterns as god, and you will need to know when to recognise this, and you will need to come up with your own opinion on whether/when they are applicable. To simply not mention them at all in a course also seems unfortunate.</p>

<p>In conclusion, it's not necessarily "bad" that your course doesn't teach patterns. It's either an omission, or it's "good". There's not really much way to know without having a productive, educational discussion with your course convener.</p>

<p>Also, do bear in mind that "computer science" and "software development" are completely different things; though many Universities mistakenly call software development courses "computer science" out of habit, it's possible that your course is an honest-to-god CS course, in which the whole discussion of design patterns isn't particularly relevant anyway.</p>

CC BY-SA 4.0
2019-02-18T14:05:07.330Z
I'd argue it *was* a problem-solving tool - or rather, when you realized "Oh, this looks like a Visitor", you could go to the ready library of visitor-implementations to avoid having to write everything again, with a new set of mistakes in the implementation.
Luaan
CC BY-SA 4.0
2019-02-18T14:25:03.510Z
@Luaan Well, that may be true, at the implementation layer. I'm talking about the design layer :)
Lightness Races in Orbit
CC BY-SA 4.0
2019-02-18T21:21:51.260Z
I came to say this, and you saved me typing.  As for "ready library of visitor implementations"; in my experience, only if you are already committed to some "framework".  I mean, imagine importing Qt just to add signals and slots to your application.  Possibly this is different in "framework languages" like Java/C#.
Yakk
CC BY-SA 4.0
2019-02-23T03:05:04.710Z
@Lusan Nonsense. There is no 'ready library of visitor-implementations'. Every one has its own purpose. That is the whole idea. Design patterns is not a library, it is a technique.
user207421
CC BY-SA 4.0
2019-02-24T10:58:05.497Z
@user207421 Can't state that any stronger. And if someone writes code in Swift, the whole "visitor pattern" disappears, because instead of creating some "Visitor" class you just pass a closure as a function argument.
gnasher729
CC BY-SA 4.0
2019-02-17T17:17:39.093Z
2019-02-17T17:17:39.093Z
Lightness Races in Orbit
<p>Buffy has stated much of what I would have, so I won't repeat. But do read that answer carefully.</p>

<hr>

<p>The first point is, university is for proper formal education, which means heavy theory and less practicals. University is not for job training (there are lesser schools for that). That is what makes a university education better than a job training school, and what makes the starting income higher.</p>

<p>The second point is this. Education is deteriorating badly, CS in particular. In all countries (Brazil is actually less damaged than many Western countries). The basics are not being taught properly, or not being taught at all. Any of the CS graduates that we hire are clueless about basic logic, but they are expert is some irrelevant thing from last year that everyone has forgotten about this year because there is a new fad and terminology. They lack logic in their speech; their thinking; and of course their programs.</p>

<ul>
<li>Half the time, in order to cut through the argument, I have to draw an <a href="https://en.wikipedia.org/wiki/Structured_systems_analysis_and_design_method" rel="noreferrer">SSADM</a> diagram, or an <a href="https://en.wikipedia.org/wiki/IDEF0" rel="noreferrer">IDEF0</a> model, or a flowchart, or code the important part for them in <code>awk</code>, which scares the bejeezus out of them. Then the lights go on in their heads, and they can code. The problem is they can code, but they cannot think.</li>
</ul>

<p>Instead, many unnecessary, current-fad things are being taught. Design patterns is one of them. Without the underlying foundation, it is quite meaningless. Sure, the marketing is good, just as it is for chaos theory and other forms of insanity. The problem with it is:</p>

<ul>
<li><p>it approaches the target bottom-up (thinking, and good systems design, is top-down)</p></li>
<li><p>it has patterns in mind. Not design patterns (design is not a pattern), but implementation patterns.</p></li>
<li><p>it promotes a single tool mentality (Maslow's Hammer: if all you have is a hammer, every problem looks like a nail).</p></li>
</ul>

<p>It teaches you to look at the problem in terms of a predefined set of solutions (all bad, and very limited), and just match one to the other. Good for simple robots (without AI). Not good for humans, or AI-capable robots. It is like when learning to be a barista, learning 100 ways to froth the milk, and to make pretty pictures in the foam, but not learning what coffee is, or where it comes from.  On the other hand, if you learn the basics, you can make any type of coffee, and anoint it with an infinite number of pictures.</p>

<p>You need to learn:</p>

<ul>
<li>to understand and analyse problems</li>
<li>know design and methods, and apply them</li>
<li>methodologies and standards (unless you work in China)</li>
<li>SSADM and IDEF0, not UML (it is not a standard, and it has no facility for analysis or for design)

<ul>
<li>problem decomposition, and then solution composition</li>
<li>architecture (literally, the way to ensure that each code segment is deployed in the right location)</li>
</ul></li>
<li>come up with a complete system (good case studies)</li>
<li>for programming, you need:

<ul>
<li>Logic, formal logic, and even more logic</li>
<li>proper diagramming</li>
<li>ability to program in any language (not stuck to Java or C++ or OO/ORM ... it is quite useless to be able to code objects without understanding deeply what the heck the object is)</li>
</ul></li>
<li>for everything, you need to understand normalisation properly (it is pretty limited to know only the NFs, or to apply them only to data).</li>
</ul>

<blockquote>
  <p>the problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern</p>
</blockquote>

<p>No. If you said that in an interview, I wouldn't hire you, because it indicates a very narrow mindset, and a lack of understanding that problem solving, not pattern matching, is the CS skill that I am hiring you for. In the real world, we need what I have explained above.</p>

<p>Trust your university, and your teachers, not the latest faddy books.</p>

CC BY-SA 4.0
2019-02-18T07:13:05.313Z
*"It teaches you to look at the problem in terms of a predefined set of solutions"* - ohh, this reminds me of applicants I interviewed who could easily put together a Java application which skimmed some famous website for data, presented it in a nice UI, and did other interesting things, by combining the perfect free libraries for the task, but utterly failed fizzbuzz-style tasks. I've even seen one who couldn't write a code to determine which one of 3 integers is the largest. He couldn't find the library which would do it for him.
vsz
CC BY-SA 4.0
2019-02-18T14:00:43.283Z
@vsz To be fair, it's not like there isn't a market for those kinds of guys :) In the end, you've got a job to do - and if you can do it better, good for you. Some jobs require you to be good at analytical thinking and comparing integers; for some, the issues are purely academic. Hey, it's not like any other engineering discipline has it any different - it's just that software engineering just isn't quite mature in that way yet, and we still expect every software engineer to be able to (with some training and experience) replace any other software engineer.
Luaan
CC BY-SA 4.0
2019-02-20T16:02:24.130Z
Mostly agreed, except for IDEF0, SSADM. They should definitely be there as an option but definitely not a requirement. They're more SoftEng than CS (unless your University merges those... then I guess they should be there).
Steven Armstrong
CC BY-SA 4.0
2019-02-22T13:18:58.433Z
"Brazil is actually less damaged than many Western countries". Why is that so? I'm curious about it.
taavs
CC BY-SA 4.0
2019-02-23T20:47:40.923Z
There are a few truths buried in here, but most of the answer reads as a pompous rant, pushing a very narrow view of the "correct" university course. Apparently, I was taught wrong, because I've never heard of SSADM or IDEF0; maybe they're "some irrelevant thing from last year that everyone has forgotten about this year because there is a new fad and terminology".
IMSoP
CC BY-SA 4.0
2021-01-01T15:22:20.013Z
“methodologies and standards (unless you work in China)” why ? I am not offended but curious.
Qiulang 邱朗
CC BY-SA 4.0
2019-02-17T15:24:00.960Z
2019-02-19T04:06:33.710Z
2019-02-19T04:06:33.710Z
PerformanceDBA
<p>I'm at final year of my graduation in Computer Science in Brazil. The university that I study is one of the best in the country and my passion is for Software Engineering. It disappoints me, in Software Engineering classes, that no Design Patterns are taught at all, my professor only commented about their existence. From my point of view, this is terrible for every student, because the problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern. So I'm thinking, this can reduce the quality of the course?</p>

CC BY-SA 4.0
2019-02-16T19:54:46.023Z
@Patricia they teach Data Structures and the only Code organization concept is MVC
olegario
CC BY-SA 4.0
2019-02-17T01:20:52.213Z
Better than average, I would say!
hobbs
CC BY-SA 4.0
2019-02-17T08:21:15.320Z
*"problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern"* - I'd disagree with this way of thinking and recommend reading this for a different view: https://softwareengineering.stackexchange.com/a/227880  - Overall, learning "patterns" often isn't useful to an undergraduate or junior programmer, and could even be counter-productive if it results in re-enforcing a misguided way of thinking about OO design.  It's far better to focus on the underlying software design principles such as 'SOLID' and 'GRASP' instead.
Ben Cottrell
CC BY-SA 4.0
2019-02-17T13:41:17.427Z
In computer science, as in every other endeavour, snake oil is not a substitute for thought. Design patterns are not *necessarily* snake oil, but they are often used that way. See many "answers" on the programming forums here for examples of "the best way" to do something by replacing 5 lines of straightforward code with 100 lines that conform "better" to the latest (often half-understood) whims and fancies of the currently fashionable software design gurus. Of course if your productivity is measured by LOC (more snake oil, of course) then "longer" is "better" by definition!
alephzero
CC BY-SA 4.0
2019-02-17T23:33:46.297Z
Note: The original design patterns boot has about 20 patterns, and states that this is all there are. It also discusses MVC, but does not list this as a pattern. The book that inspired this one “A Pattern Language” — Christopher Alexander, has about 250 patterns, and states that this is not them all, there are many others. This book is worth a read (When you have some experience). As are the other 2 in the series (“The Timeless Way of Building”, and “the Oregon Experiment”)  You should also read his later works, “The Nature of Order”
ctrl-alt-delor
CC BY-SA 4.0
2019-02-18T09:12:52.463Z
@alephzero, I think that "*cargo cult*" is a better analogy here than snake oil.
Peter Taylor
CC BY-SA 4.0
2019-02-18T11:07:33.703Z
As a senior programmer with 17 years of experience I can already tell that you're expecting way too much from your CS course. University programming education is more of a hobby, with very little relevance to industry. Programming for style is not at all what programming for money is. Sit back and enjoy the course while it lasts, but your actual education will start with your first job - and will never end since then.
Agent_L
CC BY-SA 4.0
2019-02-18T13:12:39.733Z
Speaking as a programmer with 40 years of experience, what's a "design pattern"?
Hot Licks
CC BY-SA 4.0
2019-02-18T13:46:57.193Z
@PeterTaylor It's "cargo cult" for the honest folk, and "snake oil" for the shifty guys :P
Luaan
CC BY-SA 4.0
2019-02-18T17:59:27.127Z
Honestly, I would say that design patterns warrant at most one optional course in a CS degree, and at that, it would be *theory* of design patterns, rather than any concrete example. Most design patterns are heavily linked to a particular language, and some languages flat out don't have any design patterns, or have at most one that covers everything. It after all a CS degree and not a programming certification.
Steven Armstrong
CC BY-SA 4.0
2019-02-18T19:01:24.650Z
@alephzero I think that design patterns have their place, but their real purpose is unfortunately frequently misunderstood and their importance often exaggerated, see also [this discussion on softwareengineering.se](https://softwareengineering.stackexchange.com/questions/9219/).
Discrete lizard
CC BY-SA 4.0
2019-02-18T20:51:24.003Z
The advice in the Jargon File for new hackers to learn a LISP (for "the profound enlightenment experience you will have when you finally get it") is relevant here. What a C++ developer needs to codify as "design patterns" are merely macros in a LISP, and can be thus used as library functions with no need to reimplement them over and over.
Charles Duffy
CC BY-SA 4.0
2019-02-19T01:25:16.067Z
@BenCottrell SOLID and GRASP are just as harmful as any design pattern. They result in the same sort of dogmatism that leads to nightmare code. The only valid metric of code quality is what-the-hecks per minute.
jpmc26
CC BY-SA 4.0
2019-02-19T12:52:20.950Z
@jpmc26 I think you may misunderstand SOLID and GRASP - they are merely sets of principles (i.e. guidelines), and not rules to be followed dogmatically as you suggest -- quite the opposite in fact, they aren't measurable nor can they be defined in any objective terms, if someone happens to treat them this way then they've completely missed the point of those principles, which I can well believe would lead to nightmare code, but only as a result of plainly misunderstanding what those principles are and why they exist, rather than as a consequence of following their advice.
Ben Cottrell
CC BY-SA 4.0
2019-02-19T13:24:34.067Z
Reading [The Perils of Java Schools](https://www.joelonsoftware.com/2005/12/29/the-perils-of-javaschools-2/) by Joel Spolsky (one of the cofounders of Stack Exchange) leads me to believe that it is potentially a sign of *quality* to not have such a class. Outside of the over-engineered Java (or C++) world, such things don't play such a prominent role (which isn't to say that they play no role).
John Coleman
CC BY-SA 4.0
2019-02-19T15:10:33.820Z
FWIW: I took my SE class in 1988, before "Design Patterns" were A Thing, and people still seem to accept that my degree is a valid CS degree.
T.E.D.
CC BY-SA 4.0
2019-02-20T00:34:56.337Z
Remember what happened when Robert Pirsig tried to teach 'quality' in college...
Scott Rowe
CC BY-SA 4.0
2019-02-20T00:55:22.113Z
@BenCottrell I don't. The easiest example is that I've seen pervasive dependency inversion regularly lead to incredibly weird and difficult to follow object trees, even *encouraging* shared stateful objects (database connections) that are quietly injected into the lowest level of dependencies. It was difficult to follow what actually happened to a connection in a given code path. As for "not rules to be followed dogmatically," the same could be said for design patterns. The problem is precisely that people take them too far, replacing understanding and wisdom with pervasive blind application.
jpmc26
CC BY-SA 4.0
2019-02-20T01:27:48.563Z
@ScottRowe - Yeah, he went crazy.
Hot Licks
CC BY-SA 4.0
2019-02-20T03:23:32.307Z
@HotLicks: Design Patterns are observations about the horrible things OOP programmers do, presented as something to mimic...
R.. GitHub STOP HELPING ICE
CC BY-SA 4.0
2019-02-20T03:33:43.223Z
@R.. I try not to mimic programmers who go OOPS!
Hot Licks
CC BY-SA 4.0
2019-02-20T07:17:53.623Z
@jpmc26 *"The problem is precisely that people take them too far, replacing understanding and wisdom with pervasive blind application"* - surely that's all the more reason to have proper teaching of those principles?    The example you mention with dependency inversion sounds like it actually violates the principle ('Details should depend upon abstractions').
Ben Cottrell
CC BY-SA 4.0
2019-02-20T08:18:18.283Z
@BenCottrell They're too subjective for them to be taught "properly." They're not tied to anything concrete. Having them taught "properly" would be even harder than doing so with design patterns. If we can't get that right, there's no way we could with something as subjective as SOLID and GRASP. Your response to my example demonstrates this subjectivity and lack of clarity. FYI, they did "depend on abstractions;" the system pervasively used interfaces for everything. This could even be turned into an argument *for* the design: callers did not need to reference a connection.
jpmc26
CC BY-SA 4.0
2019-02-20T09:07:10.750Z
Your headline is another question than your question itself. Are you talking about a computer science course (headline) or a software engineering course (question text)? A SE course probably should include patters, almost every other course probaly does not have to and probably should not. computer science courses should teach principles, programming courses should teach programming without such overhead. But software engineering courses of course probably should teach such things. Please clarify if we're talking about a software engineering course or not.
allo
CC BY-SA 4.0
2019-02-20T09:55:34.273Z
Title is "begging the question" - a better form would be eg. "Should a good CS course always teach Design Patterns". IMHO, no - but it should be in the Programming modules.
MikeW
CC BY-SA 4.0
2019-02-20T16:33:12.213Z
@jpmc26 How could a topic be 'too subjective' to be taught properly?   Many academic courses require students to think and understand subjective material, otherwise if CompSci were only to include objective topics then that leads to precisely the problem you mention of students mindlessly sticking to dogma because they haven't had the opportunity to learn to understand the rationale behind these principles nor judge these things for themselves.
Ben Cottrell
CC BY-SA 4.0
2019-02-20T17:55:29.920Z
Are you using "course" to mean "degree program"? In the US, standard use of "course" is to mean "class".
Acccumulation
CC BY-SA 4.0
2019-02-21T05:08:48.917Z
@BenCottrell By being "counter-productive if it results in re-enforcing a misguided way of thinking about OO design." This is exactly what I see happens with SOLID. SOLID is *not* practical advice that can be applied to the process of writing code. It's a list of abstract, easily misapplied, hard to understand criteria that purport to describe a high quality end result (though whether it even necessarily identifies qualities that are actually important is up for debate). And it is the subjectivity of its ideas that lead to such diverse ideas about what in the heck it's even supposed to mean.
jpmc26
CC BY-SA 4.0
2019-02-22T00:59:41.763Z
@jpmc26 It's not about teaching practical advice, and it's not specifically about teaching SOLID either (GRASP and SOLID are only part of the picture) - it's about getting students to think for themselves by challenging them to grapple with the issues around software design so that they understand it's not a prescriptive process.    If students are never asked to think about concepts such as cohesion, coupling, separation of concerns, abstraction, dependencies, etc then they will enter the job market in a weak position, and more likely to misapply SOLID or even just create a Big Ball Of Mud.
Ben Cottrell
CC BY-SA 4.0
2019-02-22T03:20:40.490Z
@BenCottrell On the contrary, I find people who are intent on following SOLID at least as likely (if not more so) to create Big Balls of Mud. All of the principles and concepts you have mentioned are at best unhelpful in avoiding that. Our "theories" about how to build good code do not work. Even *having* these poor acronyms and overhyped terms invites people to misapply them in ways that are harmful to a code base. If we want to teach something, then practical ways of evaluating code quality is what we need to be focusing on, not these useless buzzwords.
jpmc26
CC BY-SA 4.0
2019-02-22T03:55:44.060Z
@BenCottrell I don't agree with *everything* in this talk and I understand that languages don't always have the features to make all the particular simplifications possible, but it still describes a better philosophy toward writing code than SOLID or GRASP or any of that stuff: https://youtu.be/o9pEzgHorH0. To sum it up, it basically says not to make anything more complicated than it has to be. The fact we don't spend enough time teaching people to be this practical is a major, major problem.
jpmc26
CC BY-SA 4.0
2019-02-22T12:53:33.427Z
@jpmc26 You don't seem to be reading what I've said -- it's **not** about getting students to *follow* anything, it's about teaching them to *think*.  At this point we seem to be talking past each other, and you seem to be hung up on issues you've had with programmers who clearly didn't bother to think.    Just to repeat once again, the purpose of teaching software design is all about challenging students to think about software design, and not about "following" rules. If students aren't encouraged to think at university, then they're more likely not to think at all when they're in a job
Ben Cottrell
CC BY-SA 4.0
2019-02-22T13:05:40.087Z
@BenCottrell I read what you said. You don't seem to be grasping that whatever your intention is, that *isn't* the result you actually get. The programmers I worked with thought *a lot*, but buying into the popular OO ideas clouded their judgement. As I often see it do here on SE. Have [an example](https://codereview.stackexchange.com/questions/212381/versatile-string-validation/212432#comment410907_212432).
jpmc26
CC BY-SA 4.0
2019-02-22T13:15:12.083Z
@jpmc26 So when do students learn about software design then?   Because they *will* be required to learn one way or another as soon as they enter the workplace and are asked to join a team working on any reasonably large, non-trivial project with other software engineers.     They can either learn it at university when they've got the time to research the topic properly, or they can be forced to learn it under far less than ideal conditions when there are deadlines and stakeholders.
Ben Cottrell
CC BY-SA 4.0
2019-02-22T13:15:26.810Z
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/90084/discussion-between-jpmc26-and-ben-cottrell).
jpmc26
CC BY-SA 4.0
2019-02-22T19:26:24.267Z
I'm confused by the question; here's a way you could clarify it. Is a course in *astronomy* that does not teach *how to build a telescope* a bad course or a good course?  Is a course in *physics of structural engineering for buildings* that does not teach *how to design an elegant courtyard* a bad course or a good course?  You're asking a question about two things that have almost nothing to do with each other but your question indicates that there is some connection in your mind; can you explain what it is?
Eric Lippert
CC BY-SA 4.0
2019-02-23T02:59:45.500Z
@EricLipper Agree entirely. In the design patterns epidemic of the late 1990s there seemed be a sustained attempt to reduce all of CS to design patterns. It failed miserably, like all other attempts to impose magic on science. Even back in the 'top-down' days I remember thinking that this approach would never tell you how to write a compiler. Curiously enough Wirth, a compiler writer, was a proponent. Knuth said mildly that he preferred to think bottom-up ...
user207421
CC BY-SA 4.0
2019-02-23T14:46:23.797Z
Imho the only benefit in learning design patterns is that you can quickly speak about implementations in a team without having to verbosely explain your solution since the pattern has a name. Much more important than knowing design patterns is knowing anti-patterns to avoid running in non-obvious issues which others already did frequently before you.
Pinke Helga
CC BY-SA 4.0
2019-05-10T14:29:03.020Z
For the majority of the history of CS, design patterns hadn't been "discovered". At least, the term. "Algorithms + Data Structures = Programs" was the closest I remember from college.
Rob Crawford
CC BY-SA 4.0
2021-12-16T14:20:49.330Z
I love design patterns. However, it is more a "how do we work together in a big programming team" than a CS issue.
Sascha
<curriculum-design>
How bad is a Computer Science course that doesn't teach Design Patterns?
# How bad is a Computer Science course that doesn't teach Design Patterns?

(Asked by: username_0 on 2019-02-16)

I'm at final year of my graduation in Computer Science in Brazil. The university that I study is one of the best in the country and my passion is for Software Engineering. It disappoints me, in Software Engineering classes, that no Design Patterns are taught at all, my professor only commented about their existence. From my point of view, this is terrible for every student, because the problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern. So I'm thinking, this can reduce the quality of the course?

**Tags:** curriculum-design

> **Comments:**
> **username_0**: @Patricia they teach Data Structures and the only Code organization concept is MVC  
> **username_1**: Better than average, I would say!  
> **username_2**: *"problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern"* - I'd disagree with this way of thinking and recommend reading this for a different view: https://softwareengineering.stackexchange.com/a/227880  - Overall, learning "patterns" often isn't useful to an undergraduate or junior programmer, and could even be counter-productive if it results in re-enforcing a misguided way of thinking about OO design.  It's far better to focus on the underlying software design principles such as 'SOLID' and 'GRASP' instead.  
> **username_3**: In computer science, as in every other endeavour, snake oil is not a substitute for thought. Design patterns are not *necessarily* snake oil, but they are often used that way. See many "answers" on the programming forums here for examples of "the best way" to do something by replacing 5 lines of straightforward code with 100 lines that conform "better" to the latest (often half-understood) whims and fancies of the currently fashionable software design gurus. Of course if your productivity is measured by LOC (more snake oil, of course) then "longer" is "better" by definition!  
> **username_4**: Note: The original design patterns boot has about 20 patterns, and states that this is all there are. It also discusses MVC, but does not list this as a pattern. The book that inspired this one “A Pattern Language” — Christopher Alexander, has about 250 patterns, and states that this is not them all, there are many others. This book is worth a read (When you have some experience). As are the other 2 in the series (“The Timeless Way of Building”, and “the Oregon Experiment”)  You should also read his later works, “The Nature of Order”  
> **username_5**: @username_3, I think that "*cargo cult*" is a better analogy here than snake oil.  
> **username_6**: As a senior programmer with 17 years of experience I can already tell that you're expecting way too much from your CS course. University programming education is more of a hobby, with very little relevance to industry. Programming for style is not at all what programming for money is. Sit back and enjoy the course while it lasts, but your actual education will start with your first job - and will never end since then.  
> **username_7**: Speaking as a programmer with 40 years of experience, what's a "design pattern"?  
> **username_8**: @PeterTaylor It's "cargo cult" for the honest folk, and "snake oil" for the shifty guys :P  
> **username_9**: Honestly, I would say that design patterns warrant at most one optional course in a CS degree, and at that, it would be *theory* of design patterns, rather than any concrete example. Most design patterns are heavily linked to a particular language, and some languages flat out don't have any design patterns, or have at most one that covers everything. It after all a CS degree and not a programming certification.  
> **username_10**: @username_3 I think that design patterns have their place, but their real purpose is unfortunately frequently misunderstood and their importance often exaggerated, see also [this discussion on softwareengineering.se](https://softwareengineering.stackexchange.com/questions/9219/).  
> **username_11**: The advice in the Jargon File for new hackers to learn a LISP (for "the profound enlightenment experience you will have when you finally get it") is relevant here. What a C++ developer needs to codify as "design patterns" are merely macros in a LISP, and can be thus used as library functions with no need to reimplement them over and over.  
> **username_12**: @BenCottrell SOLID and GRASP are just as harmful as any design pattern. They result in the same sort of dogmatism that leads to nightmare code. The only valid metric of code quality is what-the-hecks per minute.  
> **username_2**: @username_12 I think you may misunderstand SOLID and GRASP - they are merely sets of principles (i.e. guidelines), and not rules to be followed dogmatically as you suggest -- quite the opposite in fact, they aren't measurable nor can they be defined in any objective terms, if someone happens to treat them this way then they've completely missed the point of those principles, which I can well believe would lead to nightmare code, but only as a result of plainly misunderstanding what those principles are and why they exist, rather than as a consequence of following their advice.  
> **username_13**: Reading [The Perils of Java Schools](https://www.joelonsoftware.com/2005/12/29/the-perils-of-javaschools-2/) by Joel Spolsky (one of the cofounders of Stack Exchange) leads me to believe that it is potentially a sign of *quality* to not have such a class. Outside of the over-engineered Java (or C++) world, such things don't play such a prominent role (which isn't to say that they play no role).  
> **username_14**: FWIW: I took my SE class in 1988, before "Design Patterns" were A Thing, and people still seem to accept that my degree is a valid CS degree.  
> **username_15**: Remember what happened when Robert Pirsig tried to teach 'quality' in college...  
> **username_12**: @BenCottrell I don't. The easiest example is that I've seen pervasive dependency inversion regularly lead to incredibly weird and difficult to follow object trees, even *encouraging* shared stateful objects (database connections) that are quietly injected into the lowest level of dependencies. It was difficult to follow what actually happened to a connection in a given code path. As for "not rules to be followed dogmatically," the same could be said for design patterns. The problem is precisely that people take them too far, replacing understanding and wisdom with pervasive blind application.  
> **username_7**: @ScottRowe - Yeah, he went crazy.  
> **username_16**: @HotLicks: Design Patterns are observations about the horrible things OOP programmers do, presented as something to mimic...  
> **username_7**: @R.. I try not to mimic programmers who go OOPS!  
> **username_2**: @username_12 *"The problem is precisely that people take them too far, replacing understanding and wisdom with pervasive blind application"* - surely that's all the more reason to have proper teaching of those principles?    The example you mention with dependency inversion sounds like it actually violates the principle ('Details should depend upon abstractions').  
> **username_12**: @BenCottrell They're too subjective for them to be taught "properly." They're not tied to anything concrete. Having them taught "properly" would be even harder than doing so with design patterns. If we can't get that right, there's no way we could with something as subjective as SOLID and GRASP. Your response to my example demonstrates this subjectivity and lack of clarity. FYI, they did "depend on abstractions;" the system pervasively used interfaces for everything. This could even be turned into an argument *for* the design: callers did not need to reference a connection.  
> **username_17**: Your headline is another question than your question itself. Are you talking about a computer science course (headline) or a software engineering course (question text)? A SE course probably should include patters, almost every other course probaly does not have to and probably should not. computer science courses should teach principles, programming courses should teach programming without such overhead. But software engineering courses of course probably should teach such things. Please clarify if we're talking about a software engineering course or not.  
> **username_18**: Title is "begging the question" - a better form would be eg. "Should a good CS course always teach Design Patterns". IMHO, no - but it should be in the Programming modules.  
> **username_2**: @username_12 How could a topic be 'too subjective' to be taught properly?   Many academic courses require students to think and understand subjective material, otherwise if CompSci were only to include objective topics then that leads to precisely the problem you mention of students mindlessly sticking to dogma because they haven't had the opportunity to learn to understand the rationale behind these principles nor judge these things for themselves.  
> **username_19**: Are you using "course" to mean "degree program"? In the US, standard use of "course" is to mean "class".  
> **username_12**: @BenCottrell By being "counter-productive if it results in re-enforcing a misguided way of thinking about OO design." This is exactly what I see happens with SOLID. SOLID is *not* practical advice that can be applied to the process of writing code. It's a list of abstract, easily misapplied, hard to understand criteria that purport to describe a high quality end result (though whether it even necessarily identifies qualities that are actually important is up for debate). And it is the subjectivity of its ideas that lead to such diverse ideas about what in the heck it's even supposed to mean.  
> **username_2**: @username_12 It's not about teaching practical advice, and it's not specifically about teaching SOLID either (GRASP and SOLID are only part of the picture) - it's about getting students to think for themselves by challenging them to grapple with the issues around software design so that they understand it's not a prescriptive process.    If students are never asked to think about concepts such as cohesion, coupling, separation of concerns, abstraction, dependencies, etc then they will enter the job market in a weak position, and more likely to misapply SOLID or even just create a Big Ball Of Mud.  
> **username_12**: @BenCottrell On the contrary, I find people who are intent on following SOLID at least as likely (if not more so) to create Big Balls of Mud. All of the principles and concepts you have mentioned are at best unhelpful in avoiding that. Our "theories" about how to build good code do not work. Even *having* these poor acronyms and overhyped terms invites people to misapply them in ways that are harmful to a code base. If we want to teach something, then practical ways of evaluating code quality is what we need to be focusing on, not these useless buzzwords.  
> **username_12**: @BenCottrell I don't agree with *everything* in this talk and I understand that languages don't always have the features to make all the particular simplifications possible, but it still describes a better philosophy toward writing code than SOLID or GRASP or any of that stuff: https://youtu.be/o9pEzgHorH0. To sum it up, it basically says not to make anything more complicated than it has to be. The fact we don't spend enough time teaching people to be this practical is a major, major problem.  
> **username_2**: @username_12 You don't seem to be reading what I've said -- it's **not** about getting students to *follow* anything, it's about teaching them to *think*.  At this point we seem to be talking past each other, and you seem to be hung up on issues you've had with programmers who clearly didn't bother to think.    Just to repeat once again, the purpose of teaching software design is all about challenging students to think about software design, and not about "following" rules. If students aren't encouraged to think at university, then they're more likely not to think at all when they're in a job  
> **username_12**: @BenCottrell I read what you said. You don't seem to be grasping that whatever your intention is, that *isn't* the result you actually get. The programmers I worked with thought *a lot*, but buying into the popular OO ideas clouded their judgement. As I often see it do here on SE. Have [an example](https://codereview.stackexchange.com/questions/212381/versatile-string-validation/212432#comment410907_212432).  
> **username_2**: @username_12 So when do students learn about software design then?   Because they *will* be required to learn one way or another as soon as they enter the workplace and are asked to join a team working on any reasonably large, non-trivial project with other software engineers.     They can either learn it at university when they've got the time to research the topic properly, or they can be forced to learn it under far less than ideal conditions when there are deadlines and stakeholders.  
> **username_12**: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/90084/discussion-between-username_12-and-ben-cottrell).  
> **username_20**: I'm confused by the question; here's a way you could clarify it. Is a course in *astronomy* that does not teach *how to build a telescope* a bad course or a good course?  Is a course in *physics of structural engineering for buildings* that does not teach *how to design an elegant courtyard* a bad course or a good course?  You're asking a question about two things that have almost nothing to do with each other but your question indicates that there is some connection in your mind; can you explain what it is?  
> **username_21**: @EricLipper Agree entirely. In the design patterns epidemic of the late 1990s there seemed be a sustained attempt to reduce all of CS to design patterns. It failed miserably, like all other attempts to impose magic on science. Even back in the 'top-down' days I remember thinking that this approach would never tell you how to write a compiler. Curiously enough Wirth, a compiler writer, was a proponent. Knuth said mildly that he preferred to think bottom-up ...  
> **username_22**: Imho the only benefit in learning design patterns is that you can quickly speak about implementations in a team without having to verbosely explain your solution since the pattern has a name. Much more important than knowing design patterns is knowing anti-patterns to avoid running in non-obvious issues which others already did frequently before you.  
> **username_23**: For the majority of the history of CS, design patterns hadn't been "discovered". At least, the term. "Algorithms + Data Structures = Programs" was the closest I remember from college.  
> **username_24**: I love design patterns. However, it is more a "how do we work together in a big programming team" than a CS issue.  

---

## 11 answers

### Answer by username_31 on 2019-02-19. Score: 2 | Accepted answer

I wouldn't worry to much about it. My CS program at Arizona State University (circa 2010) only had Design Patters as an elective class. I knew plenty of people who never took it.

I think this comes down to the difference between "Computer Science" and "Software Engineering".

Computer Science focuses more on the theoretical side of things (algorithms, mathematical models of computing, how operating systems and compilers work, etc). It's stuff you don't directly use very often, but gives you the foundation to do any type computer work you want to do.

Software Engineering, on the other hand, is "how to make stuff". It answers questions of "How do I design the software I'm creating?", "How can teams of programmers best work together?", "How can engineering teams best work with non-engineers?", etc. It's more about the big picture view of how to make software.

CS programs generally don't spend much time on all the engineering stuff. There are so many things to learn about programming and software engineering that there is no way any university program could cover a sizable fraction of it. So they focus on the theory that will help you learn the rest on your own or as you work in industry.

I'll say this much about my experience: Even though I did take the design patterns elective at my school, it was only quick intro. It took years working before I felt like I started to get a handle of why, when, and how to use them well. And I still feel like I have a long way to go.

So as I said, don't worry to much about it. Get yourself a decent reference book, skim through it just to get a feel for what patterns are out there, and then be mindful of them as you go to work as an engineer. You'll figure it out as you go along.

> **Comments:**
> **username_25**: It's just possible that I know the person who taught your course. A friend taught there about then and was influential in the patterns community. But today, I wouldn't make it a separate course. You would just learn the techniques in CS1 CS2 while learning to program, assuming it was in an OO language. A real OO design course would normally be at a higher level than the GOF patterns. There are real architectural patterns of course.  
> **username_31**: @username_25 - Our design patterns elective was a 400 level coarse. Our professor was actually a software architect at Disney who flew down once a week just to teach the one class.  

---

### Answer by username_25 on 2019-02-16. Score: 157

There is more to a CS degree than programming and more to programming than Design Patterns. I'm actually an expert in such things and have designed and published a few as a committed member of the patterns community. If I were teaching you programming in some object-oriented language you would certainly learn about and use many such patterns, but you might never hear the names, just the usage as good ways to write programs in a certain set of languages.

However, I have a friend, also in the community, who is well known and has designed many things fundamental to areas of programming languages who doesn't use the standard design patterns you are probably thinking of at all. The reason is that he programs in LISP and CLOS, not Java and C++. His informed opinion about the design patterns is that they are merely corrections for flaws in certain languages, primarily C++. Many of the kinds of things that design patterns accomplish in C++ are done in more natural ways within Common Lisp itself without needing any such mental tricks.

So, it may well be that your curriculum is flawed, but not teaching the patters in the *Gang of Four* book is not the only indicator. (Some of those authors are friends of mine, in fact).

Moreover, there is more (much more) to CS than programming. Have you learned data structures and algorithms? Have you learned architecture and databases? Have you learned data communications and concurrency? Have you learned to work in teams on large projects? Have you learned to think abstractly and to decompose problems and compose solutions? Those are vitally important too.

> **Comments:**
> **username_32**: The last paragraph here doesn't seem to make a lot of sense as to its necessity here. The OP is not saying that a good CS program should _only_ include "design patterns", but that for _missing_ that _one_ component, it is _worse off_ (not _a failure_, but _reduced_, i.e. _incrementally_, in quality - in fact the words "reduce the quality" were the exact ones used) than a program that would have included it. Just like one skimping on algorithms, or on any of the other components you mentioned there, would be a worse off program than one that did not skimp.  
> **username_32**: Or in simple terms, a CS program must include much more than _just_ design patterns, but if you take a program that is '_just_' that "much more", and compare it to another program that is 'just' that "much more" _plus_ design patterns, it would seem the latter would be a better/more comprehensive program than the former. Moreover, especially if the latter program teaches you the _thinking_ behind the patterns, which I'd think more important than the specifics themselves, as that is how you will truly understand _why_ they are used and _when_ to use them.  
> **username_33**: As a specific example, one of the more famous patterns is a singleton. If you use java or the likes, this requires a particular combination of static pointers and private constructors to do properly. However if you are working with the language Scala, singleton is built in. You make a class as usual but call it an object rather than a class and everything works. This is why it is more important to learn to think about concepts like "I want this exactly once" than the detail in a particular language. Barring experience, a good CS degree would leave you equally prepared to learn any language.  
> **username_34**: It would be amazing if a course taught both the OOP design patterns and the "missing" features that they replace (e.g. visitor pattern <--> double or multiple dispatch, etc).  
> **username_35**: There are lots of things that could be taught in addition to the existing curriculum, but at some point we'd have to acknowledge that we need more time to do so. University gives you the theoretical background to read up on the things that didn't fit.  
> **username_36**: Not just "primarily" C++. Gang of Four design patterns are inextricably linked to C++. Whilst some of the concepts (e.g. multiple dispatch) are common across OO architectures, the Gang of Four patterns are purely C++ *implementations* of those higher concepts. It's notable that the patterns only cover features absent from C++, and do not start from the elemental features of OO such as member data and functions.  
> **username_32**: @username_33 : True, but to me, in this case, "design patterns" _is_ about concepts. It's not merely about how they can be implemented - and even then, learning how they are gives you an idea of what is going on under the hood even if you're using a language where that you don't have to actually write that implementation yourself as it's provided for you. If you don't know what a singleton _is_ , when it's useful, when it should _not_ be used, _why_ that is, and so forth, then it doesn't matter whether the language has it or not. And _that_ , imo, is what a good DP course should cover.  
> **username_37**: @username_32 I feel like that would be more of a "Design" class rather than a "Design Patterns" and said "Design Patterns" class would be more applicable to software engineering than computer science.  
> **username_38**: Re:"...Corrections for flaws....Many of the kinds of things that design patterns accomplish...in more natural ways within Common Lisp...".  Those are such pointless comments. Many kinds of things can be accomplished more naturally in C++ than Lisp because of flaws in Lisp. However, Lisp programmer's learn tricks to work around and implement those things. IOW, they use design patterns whether they want to call them that or not. At the time the Design Patterns book came out, C++ was the overwhelming OO'ish language of choice. Thus, they are obviously more applicable to the C-family of languages.  
> **username_39**: Yes, as I have told some students who complained about abstract concepts in their degree, "If you just wanted to learn to code you could have gone to a training course."  
> **username_40**: At my university I learned that the advantage of knowing the names of the design patterns is that you can communicate them easily to fellow team members. This wouldn't be possible if you don't know their names.  

---

### Answer by username_41 on 2019-02-17. Score: 51

username_25's answer perfectly addresses your question about design patterns. I would just like to add a bit of perspective about CS curricula in general.

Computer Science (CS) is very young compared to other scientific disciplines. For example maths or biology are strongly structured disciplines which rely on a quite well defined corpus of must-know basics. Of course these fields evolve, but the standard undergrad curriculum is not very different from what it was 20 years ago. On the contrary, CS is a fast evolving discipline and it is very different from what it was 20 years ago. Of course there are some broadly accepted topics, but there is no clear consensus about what a CS curriculum should contain. This is why different institutions might provide students with a significantly different background, but that doesn't necessarily mean that one is better than the other. It's important to keep in mind that a good CS curriculum is not one which provides students with the knowledge of their time, but one which prepares them to adapt and acquire new knowledge all along their professional career.

> **Comments:**
> **username_42**: +1 especially for the last sentence. I think programming will change enough to make design patterns obsolete in much less than the 40 to 50 years of a human career. Knowing how to learn and adjust to changes will go on being useful.  
> **username_8**: To be fair, there's plenty of university courses that are also evolving very quickly (e.g. chemical engineering) that handle it better. To me, it (sadly) seems that many CS courses are done just for the form, rather than the essence - it's important to have a CS course, so we have a CS course. It doesn't have any real purpose, you see, but... It's also disturbingly common to see people who have no real-world experience teach various aspects of CS. It reminds me of Feynman's famous reflection on the quality of Brazilian university education back in the day :)  
> **username_8**: Even worse, many of the things that are being touted as the best and brightest today are things that were developed decades ago. The good CS courses didn't have to change any of the fundamentals, because the fundamentals didn't change since the first ideas of electronic computers. Only the details change (as important as those details are, mind you). The only courses that need to change much are those that are either *actually* bleeding edge, or were more concerned with day-to-day practicalities rather than the actual science (for better *and* worse, mind you).  

---

### Answer by username_46 on 2019-02-17. Score: 33

It has been well known for decades by anyone coming out of University that, as you say, *"the problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern"*. And it has been well known for almost as long that this claim is wrong.

When you have a problem, you come up with a way to solve it that suits that problem and also the surrounding context. Then, if you want to describe your solution, you can find some terms/names for it — sometimes, there is already a name for the solution, so you can just use that name.

What you don't do is look at a problem and say "I know, I'll use the visitor pattern" just because it's a thing that has a name. That is an arse-backwards way to approach problem solving. You might utter that phrase out loud if you've concluded that the appropriate solution indeed does look like the visitor pattern, quite by chance.

**Design patterns are a descriptive tool, not a problem-solving tool.**

It is unusual for a University to *not* make this error, and you've mistaken it for an omission. It is possible that it is an omission. If so, I'd say it's a fortunate one.

I would have hoped, however, that your professor would at least pay lip service to design patterns because — rightly or wrongly — you will encounter loads of people in industry who treat design patterns as god, and you will need to know when to recognise this, and you will need to come up with your own opinion on whether/when they are applicable. To simply not mention them at all in a course also seems unfortunate.

In conclusion, it's not necessarily "bad" that your course doesn't teach patterns. It's either an omission, or it's "good". There's not really much way to know without having a productive, educational discussion with your course convener.

Also, do bear in mind that "computer science" and "software development" are completely different things; though many Universities mistakenly call software development courses "computer science" out of habit, it's possible that your course is an honest-to-god CS course, in which the whole discussion of design patterns isn't particularly relevant anyway.

> **Comments:**
> **username_8**: I'd argue it *was* a problem-solving tool - or rather, when you realized "Oh, this looks like a Visitor", you could go to the ready library of visitor-implementations to avoid having to write everything again, with a new set of mistakes in the implementation.  
> **username_46**: @username_8 Well, that may be true, at the implementation layer. I'm talking about the design layer :)  
> **username_47**: I came to say this, and you saved me typing.  As for "ready library of visitor implementations"; in my experience, only if you are already committed to some "framework".  I mean, imagine importing Qt just to add signals and slots to your application.  Possibly this is different in "framework languages" like Java/C#.  
> **username_21**: @Lusan Nonsense. There is no 'ready library of visitor-implementations'. Every one has its own purpose. That is the whole idea. Design patterns is not a library, it is a technique.  
> **username_48**: @username_21 Can't state that any stronger. And if someone writes code in Swift, the whole "visitor pattern" disappears, because instead of creating some "Visitor" class you just pass a closure as a function argument.  

---

### Answer by username_49 on 2019-02-17. Score: 15

username_25 has stated much of what I would have, so I won't repeat. But do read that answer carefully.

---

The first point is, university is for proper formal education, which means heavy theory and less practicals. University is not for job training (there are lesser schools for that). That is what makes a university education better than a job training school, and what makes the starting income higher.

The second point is this. Education is deteriorating badly, CS in particular. In all countries (Brazil is actually less damaged than many Western countries). The basics are not being taught properly, or not being taught at all. Any of the CS graduates that we hire are clueless about basic logic, but they are expert is some irrelevant thing from last year that everyone has forgotten about this year because there is a new fad and terminology. They lack logic in their speech; their thinking; and of course their programs.

* Half the time, in order to cut through the argument, I have to draw an [SSADM](https://en.wikipedia.org/wiki/Structured_systems_analysis_and_design_method) diagram, or an [IDEF0](https://en.wikipedia.org/wiki/IDEF0) model, or a flowchart, or code the important part for them in `awk`, which scares the bejeezus out of them. Then the lights go on in their heads, and they can code. The problem is they can code, but they cannot think.

Instead, many unnecessary, current-fad things are being taught. Design patterns is one of them. Without the underlying foundation, it is quite meaningless. Sure, the marketing is good, just as it is for chaos theory and other forms of insanity. The problem with it is:

* it approaches the target bottom-up (thinking, and good systems design, is top-down)
* it has patterns in mind. Not design patterns (design is not a pattern), but implementation patterns.
* it promotes a single tool mentality (Maslow's Hammer: if all you have is a hammer, every problem looks like a nail).

It teaches you to look at the problem in terms of a predefined set of solutions (all bad, and very limited), and just match one to the other. Good for simple robots (without AI). Not good for humans, or AI-capable robots. It is like when learning to be a barista, learning 100 ways to froth the milk, and to make pretty pictures in the foam, but not learning what coffee is, or where it comes from. On the other hand, if you learn the basics, you can make any type of coffee, and anoint it with an infinite number of pictures.

You need to learn:

* to understand and analyse problems
* know design and methods, and apply them
* methodologies and standards (unless you work in China)
* SSADM and IDEF0, not UML (it is not a standard, and it has no facility for analysis or for design)
  + problem decomposition, and then solution composition
  + architecture (literally, the way to ensure that each code segment is deployed in the right location)
* come up with a complete system (good case studies)
* for programming, you need:
  + Logic, formal logic, and even more logic
  + proper diagramming
  + ability to program in any language (not stuck to Java or C++ or OO/ORM ... it is quite useless to be able to code objects without understanding deeply what the heck the object is)
* for everything, you need to understand normalisation properly (it is pretty limited to know only the NFs, or to apply them only to data).

> the problems in the real world, both in academia and in the industry, can be more easily handled with a good choice of design pattern

No. If you said that in an interview, I wouldn't hire you, because it indicates a very narrow mindset, and a lack of understanding that problem solving, not pattern matching, is the CS skill that I am hiring you for. In the real world, we need what I have explained above.

Trust your university, and your teachers, not the latest faddy books.

> **Comments:**
> **username_50**: *"It teaches you to look at the problem in terms of a predefined set of solutions"* - ohh, this reminds me of applicants I interviewed who could easily put together a Java application which skimmed some famous website for data, presented it in a nice UI, and did other interesting things, by combining the perfect free libraries for the task, but utterly failed fizzbuzz-style tasks. I've even seen one who couldn't write a code to determine which one of 3 integers is the largest. He couldn't find the library which would do it for him.  
> **username_8**: @username_50 To be fair, it's not like there isn't a market for those kinds of guys :) In the end, you've got a job to do - and if you can do it better, good for you. Some jobs require you to be good at analytical thinking and comparing integers; for some, the issues are purely academic. Hey, it's not like any other engineering discipline has it any different - it's just that software engineering just isn't quite mature in that way yet, and we still expect every software engineer to be able to (with some training and experience) replace any other software engineer.  
> **username_9**: Mostly agreed, except for IDEF0, SSADM. They should definitely be there as an option but definitely not a requirement. They're more SoftEng than CS (unless your University merges those... then I guess they should be there).  
> **username_51**: "Brazil is actually less damaged than many Western countries". Why is that so? I'm curious about it.  
> **username_52**: There are a few truths buried in here, but most of the answer reads as a pompous rant, pushing a very narrow view of the "correct" university course. Apparently, I was taught wrong, because I've never heard of SSADM or IDEF0; maybe they're "some irrelevant thing from last year that everyone has forgotten about this year because there is a new fad and terminology".  
> **username_53**: “methodologies and standards (unless you work in China)” why ? I am not offended but curious.  

---

### Answer by username_43 on 2019-02-17. Score: 12

In general, a good education is one that teaches you to think. A good computer science education isn’t one that teaches you any specific language or technique but one that exposes you to many different concepts such as algorithms and data stuctures, as well as theories such as functional, logical programming, and objected-oriented programming, and relational database theory. At the end of it, you should be able to teach yourself new languages and tools, and pick up new paradigms.

There are some basics that I would expect every computer science education to include, such as at least one assembly language, an understanding of Turing machines, algorithmic complexity, but design patterns isn’t one of those.

I do see it as a missed opportunity though: design patterns could be covered in one lesson as part of a course on object-oriented design.

> **Comments:**
> **username_25**: Your last statement is problematic. I could certainly "mention" them in one lesson, and I might be able to "cover" them. But I wouldn't be able to actually _teach_ them. Maybe that is the level of discussion that the OP is complaining about.  

---

### Answer by username_44 on 2019-02-17. Score: 10

Since username_25 already gave such a good answer, I will post here my experience with an advanced course that focused on OOP and Design Patterns taken at a very prestigious Brazilian university.

The thing is, teaching Design Patterns is not easy. Remember that the GoF book was written as a compilation of the author's many years of experience in complex projects. Each pattern is proposed as an answer to problems that arise on certain situations. However, most students have negligible experience during college and have never experienced the difficulties described in the book. So you end up with a course that answers a lot of questions that were never asked in situations that are new to most students. In my case this took form of long expositions of patterns, their motivations and shusername_17w examples of use. Many students slept during class, memorized the patterns for the exam, got reasonably good grades and surely forgot everything afterwards. After an entire course of OOP and Patterns, most students were far from experts in patterns and I suspect they would remember very few patterns, if any at all, a month after the course.

> **Comments:**
> **username_45**: The GoF book is also more a "catalogue" of patterns, whereas correctly organized, patterns should come in the form of a *pattern language*. A lot of people seem to use the GoF book as a recipe for designing systems, which it is not. It is a catalogue of patterns where you can look up a pattern when you already know you need it. For discovering which patterns you need, you need a pattern language.  
> **username_44**: @JörgWMittag makes a good point. The GoF book is not a textbook and it is by no means didactic. Pretending it is written for beginners and using it in undergraduate-level courses is not very good teaching, IMHO.  

---

### Answer by username_14 on 2019-02-19. Score: 8

I came out of college with a fresh CS degree in 1989, to find that my colleagues were on average very much older than me (obviously), had by-and-large never heard any of the fancy "structured programming" lingo that was taught in my software engineering course at the time, and in fact mostly didn't even have CS degrees themselves.

Three decades later, the shoe's on the other foot. Our fresh-out-of-school new hires like to talk a lot in pattern lingo that didn't exist in the 1980s, and most of which honestly doesn't need to exist today. 20 years from now it will be a new fad, with new lingo.

So no, I wouldn't worry about it too much. Other than your younger co-workers, not having memorized the pattern lingo isn't going to hamstring you in the field a whole lot.

But are there fundamental things that come along with Design Patterns that you really need to know as a professional? I'd say the results there are mixed. Let's look at the tables from the [Wikipedia page on patterns](https://en.wikipedia.org/wiki/Software_design_pattern#Classification_and_list).

In the "Concurrency Patterns" table, pretty much everything in there is standard concurrency programming, that I learned in school 30 years about without benefit of the GoF lingo. Outside of that, I see about six things in all the other tables that I can say I've used over the years, when needed, but it's all just pedestrian stuff. If you have half a brain, you'd figure that out yourself if you ever need to. However, there are two exceptions: [RAII](https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization) and Singletons.

RAII is such a powerful concept and central concept, that it really should be taught. The peace of mind from not having to worry about dynamic resource lifetimes is one of the real game-changers that happened during my career. However, I'm not sure I'd call it a "pattern". Design Patterns and Code Complete seem to agree, because they don't include it. This should definitely be taught, but I don't think you need the overall "pattern" structure around it.

Singletons are just an object-oriented hack to get yourself globals, and [should almost never be used](https://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons). If they are taught at all in school, it should be as an anti-pattern to avoid, along with gotos. Yet both *[Design Patterns](http://en.wikipedia.org/wiki/Design_Patterns)* and *[Code Complete](https://en.wikipedia.org/wiki/Code_Complete)* positively teach them.

So no, I wouldn't worry about your software engineering class not being pattern-focused. You can get by just fine without them.

> **Comments:**
> **username_25**: Your general advice (don't worry about it) is sound. But the specifics are deeply flawed. Don't criticize patterns because they don't do anything _new_. That is an intended characteristic of patterns. _Capture good practice in an easily transferrable way_. They are explicitly NOT about invention. You are wrong specifically about singleton (as is much of the linked post). There are applications in which singletons are required. Don't criticize them just because some people misuse them badly. The are _not_ a hack to get globals. They are needed when _logically_ there is only one instance.  
> **username_14**: @username_25 - Heh. Disagreeing with an accepted SO post that has over a **thousand** upvotes (and only 25 down). Ballsy that. You're horribly wrong, but I give you points for taking a stand. I'll tell you that we found out how right that post was the hard way. But some of us only learn that way.  
> **username_25**: On the other hand, I've been a member of the patterns community since GOF was issued. I'm also one of the few to know that GOF wasn't actually the _first_ patterns book, though it was the first to use the name in such a public way. The "wisdom of crowds" sometimes isn't, of course.  
> **username_14**: @username_25 - However, in this case the crowd is spot on. Singletons destroy testability and make future design tweaks really problematic for no good reason. If you only want one in your current design, [only make one](https://codeahoy.com/2016/05/27/avoid-singletons-to-write-testable-code/). Problem solved. And now when you need to write unit tests, or discover three years from now that you need two copies of the entire application running at once, its not a gigantic self-inflicted redesign problem.  
> **username_25**: Patterns capture design decisions for the future as well as the present. Yes, I only create one. Some future maintainer might not _remember_ all of the design decisions previously made. So, in good software, we try to capture those decisions so that they aren't easy to subvert - especially by accident. Enums do a similar sort of thing. Build your software do that you don't need to keep every decision in your head perpetually and expect that others will have the same understanding.  
> **username_26**: Design Patterns are simply a common set of names for practices we all figured out ourselves at some point (or would figure out once we needed them).  If I called my thing a singleton and you called it a controlled-instance we wouldn't make much headway in conversation. They also tend to show implementation details you may not have thought of.  You can design without them, but if you are working on a team you will have difficulty communicating.  If you haven't at least skimmed the design patterns, don't call yourself a professional--same if you rely on them exclusively.  
> **username_27**: @BillK The bulk of the last comment is worthy. The closer, however, is not. I was a "professional" long before GoF 'Patterns' ( or C++) existed. I have still not read that book, or any related material. I also do not believe I need to because I do not need to reduce my conversations to cliches or shared inaccurate nomenclature. Don't tell me which 'pattern' you code _almost_ implements, explain what it does and how you can prove it does it correctly.  
> **username_26**: @GypsySpellweaver I suggest you at least skim it.  It's asked in enough interview questions today that you are severely restricting your job search if you don't.  I've also coded since the 80's, before patterns existed and when I read the book I recognized nearly all the patterns as ones I've created at one point or another in my career.  It's not going to teach you how to code, just how to communicate more efficiently.  My point above was that resisting knowledge like this is not professional.  A professional programmer is constantly improving himself with all the tools he can find.  
> **username_28**: In @username_25's defence, he's not being so "ballsy".  The post you linked to supports his position more than yours once you delve into the comments.  Even the author of said post asserts that they are needed from time to time: https://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons#comment2667126_138012.  
> **username_14**: @BenI. - No, he said he *uses* them from time to time, not that they are needed. Being a purely a defensive measure (over simply only creating one of the object in question), they are never *needed*.  
> **username_28**: Fair enough.  And, in your defense, you also didn't say to never use them, you said "almost never".   Everything has its time and place.  :)  

---

### Answer by username_26 on 2019-02-19. Score: 4

There isn't that much to "Teach" about design patterns. You should be able to skim one of the books in a few hours and possibly try to implement a few yourself if they confuse you.

For the most part design patterns make up for deficiencies in languages or patterns. For instance, in OO it is pretty much impossible to connect from two different "Entry Point" objects to a shared object, so we use the singleton pattern. A better solution is to use Spring (Which is more like enhancing your language to solve the problem) and then we no longer need a Singleton "Design Pattern".

If you were using a perfect programming language you shouldn't honestly NEED any patterns (Any pattern in your code is, in essence, not DRY). Design patterns are used for something that cannot be directly expressed in your language and is either too simple or too messy to put into a library.

We don't have a perfect language so we still make use of patterns. Reading about patterns isn't difficult and will give you a common language to use with your team.

I suppose if I were teaching computer science I'd require a pattern book and suggest it be read, maybe test on it, but I don't think I'd waste much class time on it.


---

### Answer by username_29 on 2019-02-18. Score: 3

The vocabulary of computer science is not as well established as the vocabulary of mathematics. Many words have different and contradictory meanings in different contexts, and it would thus be common for different people to describe some particular concept using seemingly-unrelated words, or use the same words to describe unrelated concepts.

Certain books have become sufficiently popular that many people have adopted the vocabulary used thereby. The notion that code to accomplish similar tasks would often be written in similar fashion precedes by decades any attempt to formally recognize any particular set of Design Patterns.

Although it's useful for people to have a consistent vocabulary that can concisely describe certain common patterns, there's nothing particularly "magic" about it. Being able to recognize why it is useful for certain kinds of code to accommodate certain combinations of actions is more important than knowing that a popular book refers to some combination of abilities as the "Woozle Pattern".


---

### Answer by username_30 on 2019-02-20. Score: 3

Computer Science and Software Engineering are very related but also different disciplines. When I went through my degree (ABET accredited program, US) Software Engineering was an elective (as it is *absolutely* not necessary to be a good computer scientist - though some may disagree), and in that class you learned design patterns. We would joke these were the "trade school" electives for CS graduates because if you took them you were probably going straight to industry. I took them, I went straight into industry. I took 4 programming-oriented classes in total. Two in the beginning to get your familar with the common language, and two at the end (the SE classes). Everything in the middle was pen and paper mathematics, algorithms, data structures, and compilers. Yes, many things were *implemented* in software. But it was not the *central theme* of the class. To me, design patterns are trivia that you can pick up on the job. A class is just a nice way to get started. I learned everything being a professional software engineer. In hindsight, the classes were outdated.

You are also vastly overestimating the complexity of academic code. Yes, sometimes it can get very hairy but take a stroll around arxiv. Can you name 10 papers that would be improved by knowing the Gang of Four book cover to cover? Doubtful. Proof of concept code is exactly that - it's a proof of concept. It's up to software engineers to grok it and make it beautiful.

There is so much more to Computer Science than software engineering. There are so many sub fields and software engineering is just one very very tiny one. Equating software engineering with the entire field of Computer Science is more-or-less the result of code schools being so prevalent (in my opinion). We (as a field) should really work to dispel this myth.

> **Comments:**
> **username_23**: "Proof of concept code is exactly that - it's a proof of concept. It's up to software engineers to grok it and make it beautiful." If only I could convince our R&D department of that!  

---

