Comment by πŸš€ stack

Re: "what are your thoughts on design patterns?"

In: s/programming

There are people who can cook. They understand how to match flavors, and can improvise a fine meal with whatever is on hand, fast.

And then, there are people (like me as food goes), who have no clue and need at least a recipe to be followed exactly, to make a passable meal. Some people need even more -- pre-chopped packs of onions and pre-portioned ingredients because they have poor knife skills and can't use a scale.

In the end, there is nothing wrong with cookbooks and Trader Joes cut veggies. It makes it possible for more people to enjoy homemade food.

But it would be absurd to claim that you are a better cook _because_ you go strictly from a recipe and pre-portioned factory food, because it's less error-prone or more consistent.

Adding an intrusive linked list to some datastructure is close to zero mental load for me. And I might decide that I want to do something subtly different in the process which makes my code 10 times faster, something a generic library would force me to do an extra sort on.

Yes, you are talking to an f'ing maestro of code. Enjoy your food and for god's sake learn to chop your veggies with a sharp knife.

πŸš€ stack

Feb 23 Β· 2 months ago

14 Later Comments ↓

πŸš€ lars_the_bear Β· Feb 24 at 15:54:

@stack : But "linked list" isn't really a design pattern, though, is it? It's just a common data structure. If we start use the term "pattern" for that kind of thing, I think it changes the discussion completely.

πŸš€ stack Β· Feb 24 at 16:23:

I don't know why we're even talking about linked lists or libraries.

πŸš€ LucasMW Β· Feb 25 at 08:49:

Dats structures is a much more worthwhile study than "design patterns".

πŸš€ 0x Β· Feb 25 at 09:57:

YΓ­n WΓ‘ng’s post is worth reading.

β€” Deciphering β€˜Design Patterns’

🐐 namark · Feb 25 at 12:50:

I don't know why we're even talking about linked lists or libraries

it was an extreme example of what can become a design pattern when you lack the means to reuse code, in my overall argument that design patterns are indications of weaknesses of a given language. I've seen projects in C(obviousy), Action Script 3 (the typescript before Typescript), Java, Javascript, C# and Python all suffering from linkedlistitis, where you bake it in as a part of your "business logic" and not a separate reusable utility. If you keep designing the same thing over and over again that's a design pattern, I don't think you can define it in any better way.

to link in a library
That is how you wind up with a 100MB application

that's the C ptsd talking - you don't have proper tools to express the pattern in the language in a modular way, so you push the abstraction into the runtime creating bloat. The usefulness of abstractions is supposed to entirely dwarf its cost, and a language has two options there,

not mutually exclusive.

it's also fitting that you chose to compare your work to domestic cooking, instead of any actual engineering discipline (or even professional cooking), makes a lot of sense for our snake oil industry that hinges on marketing alone, where warranty is unheard of, and everything is expected to break all the time. Now imagine wanting to wrap transformers by hand working on any serious electrical engineering project today (cause you're real good at it according to yourself), and how hard you'd be laughed out of the room for even suggesting that. Just use standard components, and if you want to design a transformer then drop this project and go do that in isolation and if you can actually come up with a new design that is even remotely better than standard in any aspect, that would likely be the greatest achievement of your entire career, and everyone and their granmas will immediately start manufacturing and using it all over the place. A less extreme example would be designing a new kind of a power supply, which is more conceivable but still not something you'd just randomly do in a completely unrelated project, just take an existing proven design, tweak whatever you are supposed to tweak and put the components on the board, that's what you do, when you are an engineer and not a maestro.

πŸš€ stack Β· Feb 25 at 14:31:

From personal experience with Model/View/Controller pattern in Smalltalk... I remember cursing a lot and going in circles pushing code from one class to another in vain whenever trying to implement anything real.

@namark - appreciate your response and kind of agree.

I consider myself more of an artist than an engineer and program entirely for the joy it brings me on a variety of levels.

My art is bug-free code. It consists of clever, concise and generally very small handmade code. Amusing comments that sometimes run for several pages when a roadside attraction gets interesting. Side projects with weird probabilistic data structures. etc. Odd interpilers and macrology.

A visual artist will spend a lifetime drawing faces and hands. Some get very good at it. Offering a set of rubber stamps will be declined with a variety of levels of politeness. A suggestion that a 10-min sketch cannot be executed well is likewise offensive.

Factory code...

πŸš€ stack Β· Feb 25 at 15:18:

There is a corporate drive to lock coding away from people. It is done through locking processors with hardware keys, factory code tech, ridiculous B2B patent trade, warranties. unions. degrees in computer pseudoscience.

Also calling what some call art 'snake oil'.

Factory crap is obviously necessary. You will not get a handcrafted chair at your office.

If the precise dimensions, repeatabilty and warranty is your only constraint, you can be proud of factory products...

If you want a custom made chair that fits you, a different story altogether. And then there are museum pieces.

🐐 namark · Feb 25 at 16:34:

off-topic intensifies...

one of those things is not like the others...

warranties

where have you seen such a thing? There are no warrnaties on any software, commercial or otherwise, even when the client is a big enterpice or a freaking government we still go "no warranty of course, why yes, of course", like the absolute clowns that we are. If waranties actually becoma a thing we all can finally stop complaining that you can't make money on free software, and maybe concider starting a real local businesses serving the general public, providing software design, installation, confoguration and WARRANTY

so what I'm saying is that your artworks are not restricted to your garage only because of the overall sorry state of the industry. A transformer you wound can be better than the one in your phone charger only if said charger came without warranty. Software insdusty is an extreme case of that where there is nothing but marketing driving it

πŸš€ stack Β· Feb 25 at 17:01:

@namark, 'warranty' was mentioned by you!

makes a lot of sense for our snake oil industry that hinges on marketing alone, where warranty is unheard of, and everything is expected to break all the time.

I don't think we are disagreement.

I may be more focused on the craft than completed product at any cost

Warranty, license, insurance and union walls have not yet been erected. Soon, with AI help desk requirements.

🐐 namark · Feb 25 at 18:56:

nah we don't agree

tldr on this off topic:

I say warranty good - you say warranty bad;

you say corporate want warranty, I say corporate hate warranty

reminder how this connects to OP:

no warranty - no quality;

no quality - anything goes;

anything goes - most things are shit;

most things are shit - your hand rolled cruft doesn't look that bad anymore;

your had rolled cruft doesn't look that bad anymore - you can keep hand rolling same cruft over and over again and feel important;

you can keep hand rolling same cruft over and over again feel important - design patterns

πŸš€ stack Β· Feb 25 at 19:49:

My penultimate OT remark here:

@namark, I tried to keep it civil. We do not have to agree on everything, and I tried pretty hard to communicate something that is important to me personally without actual personal insults.

If you want to think of my life's work as 'hand-rolled cruft' that is there 'to make me feel important', that is your choice. Verbalizing it as you have: another choice and speaks to your character.

I am bully-proof; I feel sorry that you are so insecure that you need to resort to ad hominem insults.

🐐 namark · Feb 25 at 20:49:

lol dude, next you gonna tell me you weren't even ironic calling youself maestro? Massive ego go brrrrrr

Imma clarify that I was talking about everyone and their granmas who ever wrote any code, not you in partciular, in case admin decides to pull out the banhammer over your tear jerking last words.

πŸš€ stack Β· Feb 25 at 23:00:

Brah, just to clarify: I am dead serious. A lifetime of coding compilers and other deep tech. If there is such a thing as a Master Programmer, I am it (for some kinds of code). Not ashamed to tell the truth.

And to reiterate: hostile tone and personal insults are not necessary or appreciated. Look up the definition of ad hominem

πŸ€ gritty [OP] Β· Feb 26 at 02:14:

Soooo...

how about that weather? snow gone yet in NYC?

anyways, what I got out of all this, on topic, is that in general, it's good to know what patterns are but you don't crowbar them into your code without good reason. I appreciate the (mostly) good content and explanations here. thanks to all.

Original Post

πŸŒ’ s/programming

πŸ€ gritty:

what are your thoughts on design patterns?

πŸ’¬ 29 comments Β· 1 like Β· Feb 21 Β· 2 months ago