Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Mahatma Goonsay
Jun 6, 2007
Yum
so does anyone know a good crash course on object oriented design patterns? i need it for a uh friend.

Adbot
ADBOT LOVES YOU

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

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.

MononcQc
May 29, 2007

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

AggressivelyStupid
Jan 9, 2012

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.

People tend to leave you alone about your OO opinions after that

I know some of these words

MononcQc
May 29, 2007

AggressivelyStupid posted:

I know some of these words

if you know only these people will assume you know the others

Mahatma Goonsay
Jun 6, 2007
Yum

Finster Dexter posted:

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.

thanks! i have a whole week to figure this stuff out! maybe ill build a little app or something.

Xarn
Jun 26, 2015

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.

gonadic io
Feb 16, 2011

>>=
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"

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

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

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
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

Schadenboner
Aug 15, 2011

by Shine

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.

Soricidus
Oct 21, 2010
freedom-hating statist shill
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?

Nomnom Cookie
Aug 30, 2009



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.

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"

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

Nomnom Cookie
Aug 30, 2009



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"

-- Noted SA poster Kevin Mitnick P.E.

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

Xarn
Jun 26, 2015

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?

:murder:

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



a factor of 2 in a 500 iteration loop is 1000x :shrug:

Soricidus
Oct 21, 2010
freedom-hating statist shill

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

Xarn
Jun 26, 2015
The way to 100x perf improvements usually consists of many smaller ones.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Krankenstyle posted:

a factor of 2 in a 500 iteration loop is 1000x :shrug:

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?

Nomnom Cookie
Aug 30, 2009



Krankenstyle posted:

a factor of 2 in a 500 iteration loop is 1000x :shrug:

well 2 * 500 = 1000 so your post still makes no sense

Nomnom Cookie
Aug 30, 2009



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

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



haven't had my coffee yet lol

I meant this:

Xarn posted:

The way to 100x perf improvements usually consists of many smaller ones.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
In that case you only need 10 2x improvements.

Chopstick Dystopia
Jun 16, 2010


lowest high and highest low loser of: WEED WEE
k
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.

Pie Colony
Dec 8, 2006
I AM SUCH A FUCKUP THAT I CAN'T EVEN POST IN AN E/N THREAD I STARTED

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.

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"

"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

animist
Aug 28, 2018
game programming patterns is a good design patterns book that's mostly applicable outside games

Pie 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

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
I wonder if FartFactory, ButtBuilder, PenisPrototype, and OrificeObserver have been used in the medical software world.

Mahatma Goonsay
Jun 6, 2007
Yum
Not when everything is written in mumps or worse.

VikingofRock
Aug 24, 2008




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!

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

animist posted:

game programming patterns is a good design patterns book that's mostly applicable outside games


i mean pretty much anything would make my code better

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

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Mahatma Goonsay posted:

Not when everything is written in mumps or worse.

i wonder what ))<>(( means in medical brainfuck

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Krankenstyle posted:

i wonder what ))<>(( means in medical brainfuck

means you have a hemorrhoid

healthy butt would be )x( I think

animist
Aug 28, 2018

Finster Dexter posted:

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

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

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Finster Dexter posted:

means you have a hemorrhoid

healthy butt would be )x( I think

:doh:

you need to read up on your literature

Main Paineframe
Oct 27, 2010
oE))O((3 is the one you really have to watch out for

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

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

there's no excuse for service locator, though. it's just singletons but worse

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

VikingofRock
Aug 24, 2008




Main Paineframe posted:

oE))O((3 is the one you really have to watch out for

mods

redleader
Aug 18, 2005

Engage according to operational parameters

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



please

°∈)✹(∋

Adbot
ADBOT LOVES YOU

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


holy poo poo wait a sec is


or

Krankenstyle posted:


°∈)✹(∋

a viable url now that they allow utf-whatever in urls???

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply