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
Shaggar
Apr 26, 2006
of course people abstract stuff incorrectly. people make mistakes everywhere. one of the most common mistakes is not reusing code that should be reused. his claim is you cant know that code needs to be reused until you need to reuse it but of course that's retarded. I mean maybe its true for really weird poo poo, but for something like "create a user in the database" theres only one correct way to do that and if you aren't enforcing it through a central entry point to the db (which you should and which is code reuse) you should be enforcing it through a shared data library.

If user creation changes in the future, every application that uses that shared code needs to be updated. Not because you made a mistake in reusing code, but because there is only one correct way to create a user and it has changed.

Adbot
ADBOT LOVES YOU

Volte
Oct 4, 2004

woosh woosh
i take tef's point to be roughly the same as mine: 1) your code is exactly as reusable as your abstractions are, and 2) you should never design your abstractions to facilitate your code.

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

tef posted:

i am also arguing with gimmick posters so
I am available should you like to argue with a catchphrase poster. I have been working on several new ones.

tef posted:

perisitent unbounded queues are a mistake
Well nuts to you, McGilicuddy!

Volte
Oct 4, 2004

woosh woosh

Shaggar posted:

of course people abstract stuff incorrectly. people make mistakes everywhere. one of the most common mistakes is not reusing code that should be reused. his claim is you cant know that code needs to be reused until you need to reuse it but of course that's retarded. I mean maybe its true for really weird poo poo, but for something like "create a user in the database" theres only one correct way to do that and if you aren't enforcing it through a central entry point to the db (which you should and which is code reuse) you should be enforcing it through a shared data library.

If user creation changes in the future, every application that uses that shared code needs to be updated. Not because you made a mistake in reusing code, but because there is only one correct way to create a user and it has changed.
"create user in database" is a fine abstraction. the hazardous abstraction would be something like "create Creatable in database" with the assumption that all Creatable can be implemented by filling in Blank A B and C abstract methods. that might feel nice in the same way it feels nice to put together a jigsaw puzzle but it is a nonsensical structural abstraction. these are the abstractions and instances of forced reuse that people have disdain for because it adds structural complexity without abstracting the underlying problem.

DELETE CASCADE
Oct 25, 2017

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

Volte posted:

"create user in database" is a fine abstraction. the hazardous abstraction would be something like "create Creatable in database" with the assumption that all Creatable can be implemented by filling in Blank A B and C abstract methods. that might feel nice in the same way it feels nice to put together a jigsaw puzzle but it is a nonsensical structural abstraction. these are the abstractions and instances of forced reuse that people have disdain for because it adds structural complexity without abstracting the underlying problem.

i'd start with just "create user in database" too, but what about after i've written "create table in database", "create view in database", "create function in database" plus 10 more, and there is a bunch of code in each of them, and it's all the same except for the parts that would go in A, B, and C? do i abstract further at this point, or stop because it would be harder for someone who didn't go through the same exercise to initially understand?

imo what i would probably do is use the additional abstraction to keep my code easier to maintain, but present a simpler interface without it, so the caller still just does "create user in database"

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Plorkyeran posted:

either tef’s or my (or both!) experience with dealing with production systems is atypical

it ain't you

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

DELETE CASCADE posted:

i'd start with just "create user in database" too, but what about after i've written "create table in database", "create view in database", "create function in database" plus 10 more, and there is a bunch of code in each of them, and it's all the same except for the parts that would go in A, B, and C? do i abstract further at this point, or stop because it would be harder for someone who didn't go through the same exercise to initially understand?

imo what i would probably do is use the additional abstraction to keep my code easier to maintain, but present a simpler interface without it, so the caller still just does "create user in database"

"harder for someone who didn't go through the same exercise to initially understand" is not something that can be intuited by a priori anything. it is a creature of pure empirics

presumably, you aren't working alone. even if you are working alone, you're working on a thing that takes a nontrivial amount of time

if you're not working alone, you can literally go talk to someone and say, "i'm thinking of this abstraction. would this help you understand blah blah blah"

if you are, then write down the possible abstraction you can make and then revisit it in a day or so and see if it's crap. you may also try the alleged traditional persian practice of looking at it once sober and once drunk

Volte
Oct 4, 2004

woosh woosh

DELETE CASCADE posted:

i'd start with just "create user in database" too, but what about after i've written "create table in database", "create view in database", "create function in database" plus 10 more, and there is a bunch of code in each of them, and it's all the same except for the parts that would go in A, B, and C? do i abstract further at this point, or stop because it would be harder for someone who didn't go through the same exercise to initially understand?

imo what i would probably do is use the additional abstraction to keep my code easier to maintain, but present a simpler interface without it, so the caller still just does "create user in database"
most of those things probably aren't abstractions that are related to the program you're writing. if my program deals with users and blog posts, then my core abstractions are users and blog posts. if they need to be persisted to storage, then another abstraction is my database. "create table in database" is too specific an abstraction for me to care about at the level my application deals with. somewhere in my app i need to create the table, but the actual abstraction i want to think about is "prepare the database" or something like that, so it would probably go in there. you might have some lower-level abstractions at that level to deal with it (or more likely, they have already been provided for you by your ORM or whatever) but the important part is that you don't actually have to talk about those things to talk about the concept of preparing the database.

maybe you want to support different storage engines, at which point you would need to start modeling abstractions related to that, but i mean...i think that's what people talk about when they mean "over-abstraction". it's like an overfitting problem.

Bloody
Mar 3, 2013

code reuse for reuse's sake is real bad

Thermopyle
Jul 1, 2003

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

what a hot take!

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
are your abstractions leaky?
loose?
failed?

do you have a class body you want to show off on your blog, but you're afraid what other programmers might say?

then we have just the product for you! 8 minute abstractions! That's right, folks: in just 8 minutes, you can tone, sculpt and DRY your code!

and, if you call now, we'll throw in our latest hit, 8 minute monads! In just 8 minutes, you'll learn to lift, fold and reduce your code with no side effects! That's right! No obvious side effects!

call now and you'll be showing off those function bodies just in time for the summer blog rush!

fritz
Jul 26, 2003

Bloody posted:

code reuse for reuse's sake is real bad

code is real bad

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.

MALE SHOEGAZE posted:

are your abstractions leaky?
loose?
failed?

do you have a class body you want to show off on your blog, but you're afraid what other programmers might say?

then we have just the product for you! 8 minute abstractions! That's right, folks: in just 8 minutes, you can tone, sculpt and DRY your code!

and, if you call now, we'll throw in our latest hit, 8 minute monads! In just 8 minutes, you'll learn to lift, fold and reduce your code with no side effects! That's right! No obvious side effects!

call now and you'll be showing off those function bodies just in time for the summer blog rush!

MALE SHOEGAZE is marriage material y'all

cinci zoo sniper
Mar 15, 2013




MALE SHOEGAZE posted:

The PL (Programming Language) thread: if you call now, we'll throw in our latest hit, 8 minute monads!

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
talking to peeps or waiting for abstractions also helps you create fewer, riper abstractions

pauca sed matura friendoes

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.

DELETE CASCADE posted:

i'd start with just "create user in database" too, but what about after i've written "create table in database", "create view in database", "create function in database" plus 10 more, and there is a bunch of code in each of them, and it's all the same except for the parts that would go in A, B, and C? do i abstract further at this point, or stop because it would be harder for someone who didn't go through the same exercise to initially understand?

setting aside the abstractions discussion, the specific case of creating tables, etc. programmatically shouldn't come up unless you're writing a (non-internal) orm or db management tools like ssms. and you probably aren't, so...

Fiedler fucked around with this message at 22:32 on Aug 7, 2018

Bloody
Mar 3, 2013

fritz posted:

code is real bad

teaching sand to think was a mistake

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

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.

Shaggar stop posting like an ableist piece of poo poo pls. I get talking past people is your gimmick but you can do it without sounding like king of the incels in the process.

tef
May 30, 2004

-> some l-system crap ->
anyway like not that anyone cares but if you want the edited verison of my point https://programmingisterrible.com/post/176657481103/repeat-yourself-do-more-than-one-thing-and i literally wrote it down elsewhere

Shaggar
Apr 26, 2006

jit bull transpile posted:

Shaggar stop posting like an ableist piece of poo poo pls. I get talking past people is your gimmick but you can do it without sounding like king of the incels in the process.

?

CPColin
Sep 9, 2003

Big ol' smile.

Stop using the R word as a pejorative, ding dong.

Shaggar
Apr 26, 2006

Volte posted:

"create user in database" is a fine abstraction. the hazardous abstraction would be something like "create Creatable in database" with the assumption that all Creatable can be implemented by filling in Blank A B and C abstract methods. that might feel nice in the same way it feels nice to put together a jigsaw puzzle but it is a nonsensical structural abstraction. these are the abstractions and instances of forced reuse that people have disdain for because it adds structural complexity without abstracting the underlying problem.

yeah those are bad abstractions for sure. ORMs/entity layers promote that kind of bad abstraction and its a core reason why you should always avoid them.

Shaggar
Apr 26, 2006

CPColin posted:

Stop using the R word as a pejorative, ding dong.

why?

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

it makes you a dipshit

Shaggar
Apr 26, 2006
ok

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Thank you.

redleader
Aug 18, 2005

Engage according to operational parameters

Ploft-shell crab posted:

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

most developers are smart* people doing boring, repetitive work that is, at best, of net zero value to the world. there's nothing to take pride in in the product - is it any wonder they take pride in the code they write instead?

* [citation needed]

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Don't be fatuous, Jeffrey.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Shaggar posted:

theres plenty of code that should be reused.

in the compost sense, perhaps

suffix
Jul 27, 2013

Wheeee!
i have used a number of abstraction to good effect in my programming career

not monads, tho. "this is actually a monad" is at best a curiosity

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.

redleader posted:

most developers are smart* people doing boring, repetitive work that is, at best, of net zero value to the world. there's nothing to take pride in in the product - is it any wonder they take pride in the code they write instead?

Bloody
Mar 3, 2013

tef posted:

anyway like not that anyone cares but if you want the edited verison of my point https://programmingisterrible.com/post/176657481103/repeat-yourself-do-more-than-one-thing-and i literally wrote it down elsewhere

this is a good post thanks

Max Facetime
Apr 18, 2009


is this like the N word but even worse?

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Max Facetime posted:

is this like the N word but even worse?

Why don't we just go with "all slurs are bad" and not be babies about it.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
it's a good article tef and good advice. not your fault if people who approach reuse on rigid ideological terms can't accept it

tef
May 30, 2004

-> some l-system crap ->

Bloody posted:

this is a good post thanks

unlike in here, i tend to think before posting on my blog, usually

tef
May 30, 2004

-> some l-system crap ->
i'm just literally mad 100% of the time, that's my problem

tef
May 30, 2004

-> some l-system crap ->
fwiw; i'm aware that my experience is atypical, most people i know only burn out once, rather than five or six times depending on how you count it

it's five times if you count the number of places where a doctor told me working there was physically destroying my body, it's higher if you count the jobs that have done that

Max Facetime
Apr 18, 2009

jit bull transpile posted:

Why don't we just go with "all slurs are bad" and not be babies about it.

because we don’t go all “ALL lives matter” about it either, now do we?

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Max Facetime posted:

because we don’t go all “ALL lives matter” about it either, now do we?

Wtf are you doing

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