|
so does anyone know a good crash course on object oriented design patterns? i need it for a uh friend.
|
|
|
|
|
| # ? Jan 17, 2026 19:04 |
|
Mahatma Goonsay posted:so does anyone know a good crash course on object oriented design patterns? i need it for a uh friend. This seems dece and I found it by googling design patterns: https://www.geeksforgeeks.org/software-design-patterns/ But honestly, cramming design patterns has never worked for me. I only ever learned them by using them, which is a little hilarious because a lot of times I don't know I need them unless I learn them. The Terrible Programmer Conundrum.
|
|
|
|
devs around me usually think I don't know much OO because I lived in functional land for so long. The trick I have is to mention that I have problems with OO because it tends to conflate types and classes such that you end up having "classes used as containers of a given type" and "classes as hierarchical state isolation construct" and you have to use both at once. Then mention something about multiple inheritance being hosed up, and how much you hate having to deal with covariance and contravariance issues and you much prefer traits instead. People tend to leave you alone about your OO opinions after that
|
|
|
|
MononcQc posted:devs around me usually think I don't know much OO because I lived in functional land for so long. The trick I have is to mention that I have problems with OO because it tends to conflate types and classes such that you end up having "classes used as containers of a given type" and "classes as hierarchical state isolation construct" and you have to use both at once. Then mention something about multiple inheritance being hosed up, and how much you hate having to deal with covariance and contravariance issues and you much prefer traits instead. I know some of these words
|
|
|
|
AggressivelyStupid posted:I know some of these words if you know only these people will assume you know the others
|
|
|
|
Finster Dexter posted:This seems dece and I found it by googling design patterns: https://www.geeksforgeeks.org/software-design-patterns/ thanks! i have a whole week to figure this stuff out! maybe ill build a little app or something.
|
|
|
|
Finster Dexter posted:But honestly, cramming design patterns has never worked for me. I only ever learned them by using them, which is a little hilarious because a lot of times I don't know I need them unless I learn them. The Terrible Programmer Conundrum. This. Knowing the fact that something called "template method pattern" exists is not nearly as helpful in learning to use it as seeing a real-world problem being solved by it.
|
|
|
|
you know what pattern I loving hate? The visitor pattern. like you could just accept a single lambda, that chooses which cases it wants to deal with via pattern matching. oorrrrr you could accept 100 different overridden methods to deal with each case one at a time. it's cropping up in rust which does have good pattern matching and I'm at a loving loss to figure out why except maybe "c++ devs"
|
|
|
|
Xarn posted:This. Knowing the fact that something called "template method pattern" exists is not nearly as helpful in learning to use it as seeing a real-world problem being solved by it. true but knowing patterns exist even if you don’t know them inside and out does have value I’ve never written my own pool in prod code but knowing the object pool pattern exists will keep me from doing a lovely version of my own from scratch if it does come up, for example
|
|
|
|
op, a lot of patterns are actually simple and intuitive and you may have used them without realizing even in non-OO code reading the descriptions on wikipedia even might help you connect those dots
|
|
|
|
MononcQc posted:if you know only these people will assume you know the others The entirety of my career is based on this, the "always have your bath towel" school of thought.
|
|
|
|
c++ chat: i opened some c++ today for the first time in a while, and the first thing i saw was it calling std::string::data() and then using const_cast so it could modify the result. what could possibly go wrong?
|
|
|
|
gonadic io posted:you know what pattern I loving hate? The visitor pattern. like you could just accept a single lambda, that chooses which cases it wants to deal with via pattern matching. yup visitor sucks. at least it's not 15 years ago so there are decent things like StAX. only time in the last few years i recall encountering visitor is with asm
|
|
|
|
Xarn posted:"Well, it takes 23 hours to run the weather simulation for the next day, and the granularity is continent-scale, but there is no point in optimizing it further" twice as fast would still be too slow so im not sure what your point is look i don't see what's so hard to understand. factor of 2 doesn't matter, factor of 1000 does. therefore ruby is stupid, use java, and if you need to make a syscall write a little JNI lib in C
|
|
|
|
Soricidus posted:c++ chat: i opened some c++ today for the first time in a while, and the first thing i saw was it calling std::string::data() and then using const_cast so it could modify the result. what could possibly go wrong?
|
|
|
|
a factor of 2 in a 500 iteration loop is 1000x
|
|
|
|
Kevin Mitnick P.E. posted:yup visitor sucks. at least it's not 15 years ago so there are decent things like StAX. only time in the last few years i recall encountering visitor is with asm antlr is the other major tool that I’ve used recently that encourages visitor use for both antlr and asm I figure the tool is good enough to grit my teeth and use the bad pattern
|
|
|
|
The way to 100x perf improvements usually consists of many smaller ones.
|
|
|
|
Krankenstyle posted:a factor of 2 in a 500 iteration loop is 1000x what if each iteration takes 1 second then the loop takes 500 seconds. slow it down by a factor of 2: each iteration takes 2 seconds and the loop takes 1000 seconds what kind of alien math are you using where 500 x 1000 = 1000?
|
|
|
|
Krankenstyle posted:a factor of 2 in a 500 iteration loop is 1000x well 2 * 500 = 1000 so your post still makes no sense
|
|
|
|
Xarn posted:The way to 100x perf improvements usually consists of many smaller ones. don’t you mean a rewrite in c++, which makes the code as fast as it can possibly be
|
|
|
|
haven't had my coffee yet lol I meant this: Xarn posted:The way to 100x perf improvements usually consists of many smaller ones.
|
|
|
|
In that case you only need 10 2x improvements.
|
|
|
|
Been meaning to post this for a bit now:gonadic io posted:Only thing about rust is you have to use intellij. No other IDE is nearly as good. gonadic io posted:i mean it's fine but it's also not obvious to beginners that that's what you need to do Hello from 3 months ago and thank you! I tried out IntelliJ IDEA for Rust when you mentioned it back in September and you were absolutely right. Object/method scanning and suggestions are so much faster and more complete, git integration is equally easy, theming ecosystem is not quite there but the other stuff more than makes up for it. Now that I'm writing stuff large enough to actually rub up against the borrow checker it's saving me a lot of time by highlighting my trivial mistakes so quickly. I've gone ahead and also switched over to PyCharm for my production python work and regret nothing.
|
|
|
|
gonadic io posted:you know what pattern I loving hate? The visitor pattern. like you could just accept a single lambda, that chooses which cases it wants to deal with via pattern matching. "design pattern" is just a term to describe a way to overcome a deficiency in a programming language. the GOF design patterns book was written to overcome deficiencies in 1994 java. except people read it now and think sprinkling design patterns in their code makes their code better in conclusion, don't read the GOF design patterns book
|
|
|
|
game programming patterns is a good design patterns book that's mostly applicable outside gamesPie Colony posted:"design pattern" is just a term to describe a way to overcome a deficiency in a programming language. the GOF design patterns book was written to overcome deficiencies in 1994 java. except people read it now and think sprinkling design patterns in their code makes their code better i mean pretty much anything would make my code better
|
|
|
|
I wonder if FartFactory, ButtBuilder, PenisPrototype, and OrificeObserver have been used in the medical software world.
|
|
|
|
Not when everything is written in mumps or worse.
|
|
|
animist posted:game programming patterns is a good design patterns book that's mostly applicable outside games This book seems pretty informative and well-written. Thanks for posting it!
|
|
|
|
|
animist posted:game programming patterns is a good design patterns book that's mostly applicable outside games uh Service Locator and Event Queue patterns are trash garbage don't ever use those Our Russian outsourcers love those and I loving hate them and their code so much right now
|
|
|
|
Mahatma Goonsay posted:Not when everything is written in mumps or worse. i wonder what ))<>(( means in medical brainfuck
|
|
|
|
Krankenstyle posted:i wonder what ))<>(( means in medical brainfuck means you have a hemorrhoid healthy butt would be )x( I think
|
|
|
|
Finster Dexter posted:uh Service Locator and Event Queue patterns are trash garbage don't ever use those fwiw the 'event queue' the book describes is for a single system's input, e.g. a deduplicating audio queue, which seems reasonable to me there's no excuse for service locator, though. it's just singletons but worse
|
|
|
|
Finster Dexter posted:means you have a hemorrhoid you need to read up on your literature
|
|
|
|
oE))O((3 is the one you really have to watch out for
|
|
|
|
animist posted:fwiw the 'event queue' the book describes is for a single system's input, e.g. a deduplicating audio queue, which seems reasonable to me ok yeah, that sounds pretty tame... but the Russians have all of their microservices communicating via message bus, and then internally in some of them, they have their own bespoke event queue that can handle events from itself or from the message bus and lmao good luck following that mess
|
|
|
Main Paineframe posted:oE))O((3 is the one you really have to watch out for mods
|
|
|
|
|
Main Paineframe posted:oE))O((3
|
|
|
|
please °∈)✹(∋
|
|
|
|
|
| # ? Jan 17, 2026 19:04 |
|
holy poo poo wait a sec isMain Paineframe posted:oE))O((3 or Krankenstyle posted:
a viable url now that they allow utf-whatever in urls???
|
|
|





















