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
tef
May 30, 2004

-> some l-system crap ->

MALE SHOEGAZE posted:

I really don't think LOC is the reason people advocate for reuse, I've never heard that argument in the wild. People advocate for reuse because having to fix the same bug in 50 different spots sucks.

yes but like that's because programmers are terrible at decomposing their code, rather than code reuse being good

they just don't count the times where they fixed the bug in one place and broke fifty other pieces

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

tef posted:

god bless the dictionary makers for they have been dealing with this bullshit for centuries longer than i have or ever will

dictionary makers arent really who I'd turn to to explicate the philosophical nature of abstraction

anyway, you're missing the point of my post which is in agreement with your rants about code reuse

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

tef posted:

yes but like that's because programmers are terrible at decomposing their code, rather than code reuse being good

they just don't count the times where they fixed the bug in one place and broke fifty other pieces

yeah i pretty much agree with that.


Shaggar posted:

that doesn't make any sense. how is a reusable function for formatting a phone number worse than formatting the phone number the same way in 50 different places?

i mean, that's a great case for DRY. but at the same time, everywhere I've ever worked ends up having:

code:
format_phone_number(string)

// and then, a few years later
format_phone_number(string, option, option_hash, completely_undocument_option, undocumented_option_that_injects_divs_in_june)
// Things will suck and then someone will come in, break out the core functionality, and make it a little better, and the process repeats

DONT THREAD ON ME fucked around with this message at 17:01 on Aug 7, 2018

Shaggar
Apr 26, 2006
Probation
Can't post for 3 hours!

tef posted:

yes but like that's because programmers are terrible at decomposing their code, rather than code reuse being good

they just don't count the times where they fixed the bug in one place and broke fifty other pieces

if you break those 50 places because you fixed a bug in code that was reused, you would have broken those 50 places by fixing the bug in 50 different places where you weren't reusing the code. or, more likely, you would have missed 20 locations so the bug would continue to persist in those unknown locations since upstream stuff didn't break.

tef
May 30, 2004

-> some l-system crap ->

Thermopyle posted:

also, its completely possible for tef to be correct and pro-code-reuse people to be correct because again we're using english here and english sucks for talking about what we're talking about.

kinda except i'm talking about a cause and they're talking about an effect

or something like that

code reuse isn't good, but shared behaviour being in one place is good,. code reuse isn't bad, but it introduces tight coupling—it has a benefit *and* a cost. the thing is, loose coupling is where you have to fix a bug in 50 different files.

the problem i have is not with code reuse, the idea that is a goal to achieve, rather than something we pay for to make some changes easier

CPColin
Sep 9, 2003

Big ol' smile.

tef posted:

this would have been a better post to effort reply to but i already hit my effort limit and touched on a bunch of this above. welcome to tef's recycled tweets hour, again

You should abstract your tweets to make them easier to recycle!

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

if you break those 50 places because you fixed a bug in code that was reused, you would have broken those 50 places by fixing the bug in 50 different places where you weren't reusing the code. or, more likely, you would have missed 20 locations so the bug would continue to persist in those unknown locations since upstream stuff didn't break.

what if those 50 places, other lines of code were changing all of the time—say you're doing screen scraping, or third party integrations, the duplication allows you to hack in special client code has operational benefits

the thing is, you can make obvious examples for don't repeat yourself, or code reuse, but the problem we face day to day is often more subtle. people don't understand layering, or composion, or modularity, and they make a mess of things either way

code reuse is an excuse i have heard time and time again for a decision being made

don't say 'it makes for reusable code" because that's an ideal, something you don't always have control over, say what it's actually doing

introducing tight coupling so that changes are in one place

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
If there's something I appreciate with the games industry, it's that programmers are not the center of the universe, and since we're in the bay area, someone from Google/Facebook/etc. struts in and thinks they're hot poo poo and eventually learns very quickly that programmers are just a member of a team and sometimes their opinion is disregarded in favor of an artist's opinion. That's the way it should be.

I tried to interview a team at Google working on a game project and they kept talking about how the artists were "distracting" them and how they would build tools for the baby artists who aren't smart so the programmers could go off and masturbate alone iunno. But they "hadn't decided whether the tool would be made in Unity or WebAssembly" yet. I put the phone on mute and had to scream during that sentence. They also tried to hype me up by mentioning that their concept artists were very famous artists I would recognize. When I asked about the pipeline for the actual artists, they said "what's a pipeline". When I asked about the artists using Maya to build assets, they said "oh we contract that out".

I learned a lot of things about how Google thinks during that phone call.

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.
saying "code reuse is bad" is a bit like saying "eating fat is bad." it can be bad, sure, but it's not always bad. making a declaration of this sort absent context is not helpful, and it assumes that the circumstances you find yourself in apply universally. the rejoinder to arguments of this sort should not be "but eating sugar is bad for you!" instead, take a moment to consider the limits of excessive code re-use and excessive code duplication, recognize that neither situation is ideal, and then change the loving topic to something less asinine.

Shaggar
Apr 26, 2006
Probation
Can't post for 3 hours!

tef posted:

what if those 50 places, other lines of code were changing all of the time—say you're doing screen scraping, or third party integrations, the duplication allows you to hack in special client code has operational benefits

the thing is, you can make obvious examples for don't repeat yourself, or code reuse, but the problem we face day to day is often more subtle. people don't understand layering, or composion, or modularity, and they make a mess of things either way

code reuse is an excuse i have heard time and time again for a decision being made

don't say 'it makes for reusable code" because that's an ideal, something you don't always have control over, say what it's actually doing

introducing tight coupling so that changes are in one place

If something breaks upstream and has a legitimate use case for retaining the bug in the shared code then ok maybe consider removing the reliance on the shared code but it sounds like you were using that shared code inappropriately. It doesn't mean the 99% using the shared code appropriately are wrong.

tef
May 30, 2004

-> some l-system crap ->

Fiedler posted:

saying "code reuse is bad" is a bit like saying "eating fat is bad." it can be bad, sure, but it's not always bad. making a declaration of this sort absent context is not helpful, and it assumes that the circumstances you find yourself in apply universally.

i mean that's what i am known for, small short 'X is bad' posts with no context whatsoever

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

Suspicious Dish posted:

If there's something I appreciate with the games industry, it's that programmers are not the center of the universe, and since we're in the bay area, someone from Google/Facebook/etc. struts in and thinks they're hot poo poo and eventually learns very quickly that programmers are just a member of a team and sometimes their opinion is disregarded in favor of an artist's opinion. That's the way it should be.

I tried to interview a team at Google working on a game project and they kept talking about how the artists were "distracting" them and how they would build tools for the baby artists who aren't smart so the programmers could go off and masturbate alone iunno. But they "hadn't decided whether the tool would be made in Unity or WebAssembly" yet. I put the phone on mute and had to scream during that sentence. They also tried to hype me up by mentioning that their concept artists were very famous artists I would recognize. When I asked about the pipeline for the actual artists, they said "what's a pipeline". When I asked about the artists using Maya to build assets, they said "oh we contract that out".

I learned a lot of things about how Google thinks during that phone call.

right, in games the producer and the publisher is the center of the universe

lol

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
I'd like to draw a distinction between

"code reuse is bad" and "programmers commit a multitude of sins and justify them by saying 'code reuse'"

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

bob dobbs is dead posted:

right, in games the producer and the publisher is the center of the universe

lol

Yes, the people with money have say in how that money is spent. We self-publish and make our own stupid decisions on our own terms.

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

If something breaks upstream and has a legitimate use case for retaining the bug in the shared code then ok maybe consider removing the reliance on the shared code but it sounds like you were using that shared code inappropriately. It doesn't mean the 99% using the shared code appropriately are wrong.

no it means that saying "code reuse is good" is wrong too

given that you're working on decades old code i can see why your ideas of relevant coding advice are stuck in that era too

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
i don’t think I’ve ever encountered a problem caused by too much reuse which was actually difficult to resolve. splitting a function into two function that do different things when it turns out that the similarities were coincidental rather than intrinsic is not hard or time consuming. updating five places (and missing two more) for a single change due to duplicated logic, otoh...

tef really likes to write about how everyone else is terrible and wrong with a condescending air of authority, but either tef’s or my (or both!) experience with dealing with production systems is atypical

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
good contextful content would give examples of how following maxims (like "make your code reusable") leads programmers to justify something that proved actually bad in a specific instance, then follows up by proposing a larger or more general or more context-sensitive maxim (like "when should you make your code reusable and when should you not?") that could have arguably avoided the specific bad situation

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.

tef posted:

i mean that's what i am known for, small short 'X is bad' posts with no context whatsoever

fair enough. in your case you explicitly specify that the circumstances you find yourself in apply universally.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
you guys should try to discuss this poo poo with concrete examples, most of the posts itt are hella vague and... abstract :troll:

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Suspicious Dish posted:

If there's something I appreciate with the games industry, it's that programmers are not the center of the universe, and since we're in the bay area, someone from Google/Facebook/etc. struts in and thinks they're hot poo poo and eventually learns very quickly that programmers are just a member of a team and sometimes their opinion is disregarded in favor of an artist's opinion. That's the way it should be.

I tried to interview a team at Google working on a game project and they kept talking about how the artists were "distracting" them and how they would build tools for the baby artists who aren't smart so the programmers could go off and masturbate alone iunno. But they "hadn't decided whether the tool would be made in Unity or WebAssembly" yet. I put the phone on mute and had to scream during that sentence. They also tried to hype me up by mentioning that their concept artists were very famous artists I would recognize. When I asked about the pipeline for the actual artists, they said "what's a pipeline". When I asked about the artists using Maya to build assets, they said "oh we contract that out".

I learned a lot of things about how Google thinks during that phone call.

This is also common with developers dealing with UI designers.

It's so stupid

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Plorkyeran posted:

i don’t think I’ve ever encountered a problem caused by too much reuse which was actually difficult to resolve. splitting a function into two function that do different things when it turns out that the similarities were coincidental rather than intrinsic is not hard or time consuming.

I spent hours trying to decipher a pile of C++ templates that in the end didn't really do anything significant or concrete at all, it was just a huge mess to satisfy some weird bureaucracy that didn't really exist outside the context of the architecture of the code. because somehow the author wanted to make every api reusable/extendable for its own sake.

in the original context of discussing the lack of generics in go this is what I was thinking about.

tef
May 30, 2004

-> some l-system crap ->

Plorkyeran posted:

i don’t think I’ve ever encountered a problem caused by too much reuse which was actually difficult to resolve. splitting a function into two function that do different things when it turns out that the similarities were coincidental rather than intrinsic is not hard or time consuming. updating five places (and missing two more) for a single change due to duplicated logic, otoh...

i get it, this is the thing, every time i try and give context and nuance to why I think something is a tradeoff rather than a 99% mostly good thing, someone goes "you don't need to say things like that, because i always fix those problems at the first instance"

the thing is, we're talking about what gets written in the name of code reuse, rather than how you selectively apply a rule you're claiming to never have a problem with application.

what's the need for context and nuance when you've already internalised the expertise necessary to appropriately use rules and principles in context? well, buddy

quote:

tef really likes to write about how everyone else is terrible and wrong

my beef list of things everyone else is wrong about

- perisitent unbounded queues are a mistake
- the end to end principle is how every system successfully scales
- people justify all sorts of poo poo in the name of code reuse and confuse the purpose of abstractions and modularity as a result
- everything else in 'why complex systems fail', 'why do computers stop', and a bunch of other pointless hills to die on
- pineapples don't have bilateral symmetry

quote:

with a condescending air of authority, but either tef’s or my (or both!) experience with dealing with production systems is atypical

i do feel like there's a weird thing of people taking my posts more seriously but i'm unsure how much of that is my flamboyant use of vocabulary. turns out you end up dropping a lot of 'i think' and 'i feel' from your posts because no matter how much you couch your tradeoffs people read them as absolutes and argue on that basis from the outset

i am also arguing with gimmick posters so

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

tef posted:

i get it, this is the thing, every time i try and give context and nuance to why I think something is a tradeoff rather than a 99% mostly good thing, someone goes "you don't need to say things like that, because i always fix those problems at the first instance"

the thing is, we're talking about what gets written in the name of code reuse, rather than how you selectively apply a rule you're claiming to never have a problem with application.

what's the need for context and nuance when you've already internalised the expertise necessary to appropriately use rules and principles in context? well, buddy

i... don't understand how this is a response to what i wrote? i'll try rephrasing.

in my experience, problems caused by trying too hard to reuse code are easy to fix. ripping out nonsensical abstractions and replacing them with some copied-and-pasted code has never been a complex task for me, and i've definitely encountered some nonsensical abstractions done in the name of "reusing code" (both written by myself and others).

on the flip side, not trying hard enough to reuse code has lead to problems that are very time consuming and difficult for me to solve. as a result, even if you assume that programmers will frequently do terrible things in the name of code reuse (and i don't particularly disagree about that), i would still prefer that they do those terrible things every time if that's the cost required for also reusing code in the places where it is appropriate and useful

tef
May 30, 2004

-> some l-system crap ->

Plorkyeran posted:

i would still prefer that they do those terrible things every time if that's the cost required for also reusing code in the places where it is appropriate and useful

i would rather programmers understand the consequences of their actions and choices but i can see why you'd settle

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Honestly most of my problems with this current codebase come down to "someone included a boost header"

Shaggar
Apr 26, 2006
Probation
Can't post for 3 hours!

tef posted:

no it means that saying "code reuse is good" is wrong too

given that you're working on decades old code i can see why your ideas of relevant coding advice are stuck in that era too

you're totally wrong though. theres plenty of code that should be reused because it shouldn't be done another way. Just because someone uses a shared library wrong doesn't mean the shared library is wrong.

Volte
Oct 4, 2004

woosh woosh
abstraction isnt a unit of code reusability, which I think illuminates the disagreement over the word. even a program with a hyper-specific interface that does one specific thing should be making good use of abstractions. even if your program is

code:
problem = MySpecificProblem(Shrek)
problem.solve_using_specific_solution(WindowsOnly)
those are still abstractions around talking about a problem, its solution, and the context in which those things are applied. it's hard if not impossible to avoid using abstractions and generally you're just refusing to name them, not actually refusing to use them. it really seems like what most people are railing against is using code reusability and code structure as a point of abstraction, which i agree with fully. rather than abstractions around the problem at hand, those abstractions end up being around the structure of the code. this is a natural conclusion of taking DRY to its extreme, so I also understand why some people have a knee-jerk reaction against it.

for example: if you have five UI forms and they all share a similar pattern, a lot of people would probably proceed by factoring out all the "common" base functionality into a single BaseForm that does most of the work and then customizing it slightly on a per-use-case basis. they might even follow it up by putting various hooks in for form events, adding support for validation (with future-proofing so you can add your own validation rules of course!) and so on. that's a nice abstraction right? not much code duplication, and lots of flexibility? except it's not an abstraction of the problem—a form for users to input data—but rather an abstraction of the structure of the code—i happened to do a similar thing five times so i just tied them all together and did some extra stuff just for good measure—and now your abstraction is anything but abstract: it's an implicit mish-mash of several specific implementations that share an ephemeral similarity but aren't inherently the same thing at all.

instead, if all five forms need their UI components automatically generated, then make a FormUIGeneration abstraction. if all five forms need common validation behaviour, then make a CommonValidationBehavior abstraction. then if one of them suddenly needs async validation behavior, augment that one with a AsyncValidationBehavior abstraction. hell, if one of them needs to validate that your name is Steve, then make a SteveValidationBehavior abstraction. it doesn't matter how specific and single-use it is, it's still an abstraction. its up to you to figure out how to actually create them (be they functions, classes, traits, newfangled foobars straight out of Haskell, or just established conventions that you document), but you should be able to work out which abstractions are appropriate. you can't even talk about a problem without forming abstractions about it, so thinking about the way you would describe the problem to your friend is a good place to start. and trying to explain your problem and its solution to your friend in terms of the abstractions you have chosen is also a good way to evaluate them.

tef
May 30, 2004

-> some l-system crap ->
me: what if the point of software wasn't to have reusable code....

shaggar: "code reuse is bad?"

the rest of you: tef said code reuse is bad

tef
May 30, 2004

-> some l-system crap ->
me: what if the framing for the problem is wrong—the problem with building things around reuse is that it's speculative, and needs to be done in hindsight

you: no, reuse is fine! i do exactly that despite it being completely disconnected from what i'm telling people to do

Shaggar
Apr 26, 2006
Probation
Can't post for 3 hours!
you said code reuse is bad which is retarded. you shouldn't force code that isn't reusable to be reused sure, but theres plenty of code that should be reused.

Shaggar
Apr 26, 2006
Probation
Can't post for 3 hours!
you: we need the code that formats this phone number in 100 places even though its identical. that way if 1 of 100 wants to do it wrong, they can do it wrong.
me: no theres only one correct way to do this and everyone should be doing it the same.

tef
May 30, 2004

-> some l-system crap ->
here i am trying to talk about how to hold the knife and here's the rest of you talking about how much you like stabbing

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

you said code reuse is bad which is retarded. you shouldn't force code that isn't reusable to be reused sure, but theres plenty of code that should be reused.

come on shaggar i mean there's no need to talk like you watch south park and sound like you're a couple of youtube recommendations short of a proud boy

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine
most of the hardons people have for code reuse and “abstraction” just go back to the usual focus on qualities of source code instead of qualities of artifacts that every dev seems to suffer from. we’ve somehow managed to convince developers their value to the business is the production of (“elegant”) code

Shaggar
Apr 26, 2006
Probation
Can't post for 3 hours!

tef posted:

here i am trying to talk about how to hold the knife and here's the rest of you talking about how much you like stabbing

tefs knife has no handle and 4 blades because nobody is gonna tell him how human hands work

tef
May 30, 2004

-> some l-system crap ->
like i do like arguing but it would be great to argue about the things i've actually said over things you've made up


i mean i said stuff like 'fetisihizing code reuse' and here we are several pages deep in people joining in to defend it from even the mildest criticism

Shaggar
Apr 26, 2006
Probation
Can't post for 3 hours!
you cant make assumptions about hands! what if someone wants to hold the knife by stabbing themselves with it. think about how much more secure it would be!

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

as someone who doesnt really know if tef is right, but thinks his points at least sound good i just wanna say: either tef is bad at communicating what he means or] people are defensive about how they code unlike those others which keeps them from getting what he's saying...or most likely a combination of both and other stuff


i think what tef is saying is that people often abstract stuff away that they shouldn't or at least they carved their abstractions out at the wrong joints, not that abstractions are a bad thing

also that if you're not going to choose the right abstraction, you're better off not doing the abstraction at all

also that most programmers are bad at choosing the right place to do the abstraction

also the way tef is writing this it sounds like they think theyre better at this than the unwashed masses


edit: or hes wrong, but i dont think thats possible

Thermopyle fucked around with this message at 18:24 on Aug 7, 2018

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
you've all been shaggared

Adbot
ADBOT LOVES YOU

comedyblissoption
Mar 15, 2006

youve been hit by
youve been struck by
a poo poo shaggarpost

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