586
u/bush_killed_epstein Apr 12 '20
Such a good feeling when you cut the fat out of your code and it still accomplishes the same thing
72
u/Mithrandir2k16 Apr 12 '20
Your comment reminds me of codegolf, although it really shouldn't.
144
Apr 12 '20
"Fat" doesn't mean lines of code (or number of classes, or any other metric like that) but the accidental complexity. If you can make something simpler without sacrificing features, reliability, security, and performance, then you should feel good about yourself, because you just made it easier to maintain.
34
u/HolyRomanSloth Apr 13 '20
Every developer working on a project before me what's a maintain?
12
4
u/SirMarbles Apr 13 '20
Iâm still a student. I can probably relate the other developers to my classmates. They code like 3 year olds. Itâs all nonsense and not labeled
3
u/HolyRomanSloth Apr 13 '20
Well I'm still in HS and already understand the pain.
3
u/SirMarbles Apr 13 '20
Iâm a sophomore in college. It gets worse. I took hs level coding and that was nothing. People get dumber as you go
4
u/jetpacktuxedo Apr 13 '20
Once you graduate and start your career you'll likely find that it's not any better in industry.
2
2
Apr 13 '20
Best programming professor I had would have a bunch of the homework and projects build upon each other. You could save yourself significant amounts of time if you wrote your previous code well and it was easy to understand/modify.
She made a big deal about this when the semester started.
1
u/SirMarbles Apr 13 '20
Thereâs a course I take junior year or senior year like that. Itâs a python course. A senior I know did the whole course in a month lol. The professor gave all the information the first day. The assignment counted for the midterm and final.
8
u/Mithrandir2k16 Apr 13 '20
Yeah, I totally get that, but somehow that wasn't the first thing that came to mind in this context.
4
Apr 13 '20
If its simpler, it likely has lower resource draw, and thus runs faster, right? (full disclosure, Im a noob to coding, but I like what I know about c++ so far lol)
18
Apr 13 '20
Not necessarily. For example, parralelization makes things run faster but is usually more complex.
9
u/dankworthington Apr 13 '20
Great example of a simple way this is not necessarily true.
To askers point, actual execution time and âcpuâ time arenât the same. So parallelization takes less execution time but obviously is doing more operations / using more resources.
Just because it uses less resources doesnât make it faster. In fact almost always you can throw MORE resources in some way to accomplish the goal faster.
4
u/the_poope Apr 13 '20
Nah, in places where performance matter, typically a few algorithms that do some special task, whether it'd be sorting or findings the shortest route through a maze, typically the simplest implementation is a brute force approach which has terrible performance. In order to make it faster, you have to do smart tricks, like cache some results, skip parts in some situations when they are not needed, and do something different in edge cases. This makes the code much more complex, but it performs much better.
However there is a difference between the complexity of a single algorithm and the overall architecture of your program. The complexity of an algorithm can typically be encapsulated, i.e. hidden away so that the user does not have to understand it and care about it. The complexity of your program architecture can't be hidden away - so everyone has to deal with it. A simple architecture does not make the code faster - but it makes it faster to maintain and add new functionality to: faster development time, not faster runtime.
18
u/DarthPlagueisTheWhys Apr 13 '20
Been converting my companyâs site from class-based React components to hooks and Next.js for the past few weeks. Soooo satisfying
4
10
2
3
u/Who_GNU Apr 13 '20
Yeah, but often it looks like it's okay at first, but breaks once it gets to some use cases you didn't anticipate.
4
u/JuvenileEloquent Apr 13 '20
MFW the horribly complicated spaghetti code I replaced with an obvious and simple version 6 months ago now has a bunch of bugs reported on it due to rare edge cases that require special business rules, and it becomes clear why it was horribly complicated spaghetti code in the first place.
1
68
52
u/sixthsurge Apr 12 '20
No, AbstractEntityBuilderFactoryConfig is not unnecessary!
37
Apr 12 '20
What about AbstractEntityBuilderFactoryConfigFactory?
35
6
u/DudePotato3 Epsilon Security Clearance Apr 13 '20
And here I was thinking I was the only one who made a IThingyTypeBuilderConfigFactory
4
u/TheZipCreator Apr 13 '20
I never understood why factories had to exist. Why can't I just fucking initialize an ovject normally? Or at least use a function to get a new one of the objects? I see no point to have an object with it's only use being to make other objects.
10
u/JuvenileEloquent Apr 13 '20
When you want to use objects but the design is so complex (or less charitably, you don't understand it properly) that you can't enumerate all the objects you need beforehand. So, you write an object that can make those objects when you figure out you need them.
It's one of a few reverse-shooting pistols in a programmer's toolbox, very easy to shoot yourself in the face when you were aiming for your foot.
4
41
u/mosskin-woast Apr 12 '20
Pro tip for deleting useless classes automatically
rm -rf ./*
14
u/chicametipo Apr 13 '20
I much prefer the lighter fluid method. Some call it a bit analog, but maybe I'm old school.
123
u/trexdoor Apr 12 '20
Our* code.
62
u/YeetLemur Apr 12 '20
Yes, all thanks to our Stack Overflow, comrade
19
u/vigilantcomicpenguin Apr 13 '20
Open source code is just communism.
10
75
18
14
14
10
8
31
u/Zanderax Apr 12 '20
-13
Apr 13 '20 edited Apr 13 '20
How is that a thing? Why 'm I surprised? Is there /r/fascistprogrammers ?
Edit: sarcasm people.
9
u/im_not_afraid Apr 13 '20
there is already /r/microsoft and other subreddits glorifying proprietary code.
Also, /r/StallmanWasRight.1
Apr 13 '20
I was being sarcastic. Jez.
11
u/im_not_afraid Apr 13 '20
don't be sarcastic about fascism... actual fascists ruined it (amongst other things) for everybody.
6
Apr 13 '20
Totally agree. I was implying that how was I not aware of that subreddit (subbed right away) and was freaked if there is a such specific thing is there a scary pollar opposition. What would fascist programmer even be. Ohhh... MS (older) Sun etc. :)
6
u/Your_People_Justify Apr 13 '20
Much of socialist projects falls outside the bounds of what is seen as political, including dedicated efforts to share knowledge on a mass scale.
Organizing for Power: Stealing Fire from the Gods has one of my favorite quotes - talking of how socialists wish to emulate Prometheus
The single most revolutionary act an intellectual in the socialist movement can do is to make scientific theory and philosophy more accessible to the masses. If the working class is to make revolution itself, as an expression of its own interests, then it needs the means to understand and organize the world that confronts it. The role of the revolutionary intellectual, insofar as they are revolutionary, is self-abolition.
5
u/zClarkinator Apr 13 '20
Much of socialist projects falls outside the bounds of what is seen as political
mostly due to the fact that liberalism only wants a set number of things to be seen as 'political'. other things like what you mentioned are supposed to fall under 'common sense', that is, something that we don't question or imagine being different. It's a form of mental control, basically.
1
15
u/Zanderax Apr 13 '20
Socalism programming make sense because there is a strong tradition of sharing in programming. There are a lot of self organising projects that make free and open source software. Under those conditions of course there will be a lot of socialists.
If you want facist programmers go to 4chan.
2
u/RootHouston Apr 13 '20
Sharing code is not socialism. It's sharing code. Public ownership of all economic resources is socialism. Let's not get this mixed-up.
3
u/Zanderax Apr 13 '20
Ok but if you are for public ownership of code then you are more likely to be for public ownership of other things as well.
3
u/Life-Practice Apr 13 '20
Code, once produced, is infinitely reproducible and thus not subject to scarcity. Other things are not.
2
u/Zanderax Apr 13 '20
I'm not saying that code sharing is socalism. I'm saying if you have a group of educated people working in an ecosystem of sharing then a higher than normal number of those people will probably be socialist.
1
u/Life-Practice Apr 13 '20
You would also think that a higher than normal number of them are able to use logic and reason, since logic and reason is necessary for programming.
2
0
-2
Apr 13 '20
Your sarcasm doesn't mean that you weren't implying that anyone not a socialist is somehow a fascist.
→ More replies (8)0
15
u/LastStar007 Apr 13 '20
GitHub is code communism. Not even being ironic.
3
u/nuephelkystikon Apr 13 '20
And now it's owned by a capitalist corporation with zero conscience.
Gitlab time.
3
u/Life-Practice Apr 13 '20
And communism only works when there is no scarcity, as is the case with infinitely reproducible digital bits of information.
1
u/Manach_Irish Apr 13 '20
Sharing and redistubtion of excess resources hase been around from about the Iron age. Offhand from reading a book on those times, many years back, it was common custom to leave supplies no longer needed at crossroads ( which was under the protection of a specific god) for travellers. Hence this custom long pre-dates communism.
4
u/LastStar007 Apr 13 '20
Sharing and redistribution of excess resources is the foundation of communism, even if the details and the aspect of throwing off the oppressing class didn't get fleshed out until the 1840s. That bit about the crossroads is neat, though! Even further bqck than that, hunter-gatherer humans lived communally, sharing resources, responsibilities, and even partnership and care for their young.
1
u/nuephelkystikon Apr 13 '20
Communism predates communism.
1
u/Manach_Irish Apr 13 '20
Your point being?
0
u/nuephelkystikon Apr 13 '20
It's an unsatisfiable statement. Predate is an antireflexive predicate.
Communism has been a thing for far longer than humanity. You being afraid to call it that doesn't erase it.
3
u/Manach_Irish Apr 13 '20
Slow clap at your attempt to obfuscate by utilising lingustic specialised jargon.
To say that "Communism has been a thing for far longer than humanity" is a statement that rather encapsulates the ideologic echo chamber that your are trapped in. That you should recognise that other social constructs, not only Communism, support behaviour of the sharing of resources is behaps the first step in opening that chamber,
1
u/nuephelkystikon Apr 13 '20
lingustic specialised jargon
This is basic predicate logic, and this is a sub primarily geared towards programmers. I'm not sure what you're doing here.
Also please, please read a book. Any book would be fine to start you off, but in context a primer on economics would help the most.
0
Apr 13 '20
[deleted]
8
u/LastStar007 Apr 13 '20
Yes, they exist. But the fact that we can get so much done, together, is proof that enough people aren't interested only in money or cutthroat competition, that greed and sabotage are not innately and inextricably human.
0
4
5
u/AudaciousSam Apr 13 '20
Like a true communist, I have as few classes as possible. Or maybe I'm lazy. Either way.
2
u/robin_diez Apr 12 '20
I usually only have one because that's what my brain can handle. Can't relate
2
2
2
2
2
u/iceixia Apr 13 '20
Suppose it goes will with the factory pattern.
Seize the means of production and all that
2
u/scaptal Apr 13 '20
sais âFuck scopes, no private variables anymoreâ and moves all variables to global scope
4
3
u/Augusto2012 Apr 13 '20
And your code works for a few days but then one day it stops working and the whole project fails.
Years later they hire another programmer that thinks that getting rid of those classes will get you a different result.
3
2
1
1
1
1
u/daron_ Apr 13 '20
Btw guy with hand, he literally had been grown couple streets away from my apartments.
1
1
1
u/acousticpants Apr 13 '20 edited Apr 13 '20
if food==adequate:
for kulak in ProductiveFarms:
remove(kulak)
return 00
u/TotesMessenger Green security clearance Apr 13 '20
2
u/zClarkinator Apr 13 '20
'tankies' = anyone left of Bernie
3
u/nuephelkystikon Apr 13 '20
Can confirm, live in the free world and we all wear tank tops over here.
0
u/Life-Practice Apr 13 '20
Stop using tanks against people who don't want to obey you and we'll stop calling you tankies.
1
u/zClarkinator Apr 13 '20
I don't have any tanks
1
-9
u/Palpatine Apr 13 '20
And just like in soviet russia, when you think you cut out the useless classes the program crashed and people starved to death.
14
u/emisneko Apr 13 '20
the last famine was in 1947, two years after a massive world war defeating the nazis wiped out a huge portion of the productive age population. according to the CIA, AMERICAN AND SOVIET CITIZENS EAT ABOUT THE SAME AMOUNT OF FOOD EACH DAY BUT THE SOVIET DIET MAY BE MORE NUTRITIOUS
-27
Apr 12 '20
Millions of anti communist civilians were shot, very funny.
20
u/Friendly_Syndicalist Apr 12 '20
The rich bastards and landlords getting shot, yes that is indeed hilarious thank you for reminding us
1
Apr 13 '20
You have no idea what you're talking about and what was happening during Stalin's repressions and the great terror. They were shooting everyone, especially educated people with good professions who could have different opinion.
-4
-9
u/Soren11112 Apr 13 '20
Lol, peasants who owned land and had 1 employee were shot... How can you claim to have a moral high ground well defending murder and colonialism on massive scale.
3
u/Friendly_Syndicalist Apr 13 '20
Don't own land then, you filthy parasite lmao
0
u/Soren11112 Apr 13 '20
Lol, it is not like they had a warning. How about don't murder people for doing nothing wrong.
0
Apr 13 '20
[deleted]
9
Apr 13 '20
Just wait until you hear about all the people that died because of the USA.
→ More replies (1)3
u/emisneko Apr 13 '20
Solzhenitsyn was a Franco-supporting reactionary who was shown up as a huge liar by access to Soviet archives
4
u/emisneko Apr 13 '20 edited Apr 13 '20
There were two âReigns of Terror,â if we would but remember it and consider it; the one wrought murder in hot passion, the other in heartless cold blood; the one lasted mere months, the other had lasted a thousand years; the one inflicted death upon ten thousand persons, the other upon a hundred millions; but our shudders are all for the âhorrorsâ of the minor Terror, the momentary Terror, so to speak; whereas, what is the horror of swift death by the axe, compared with lifelong death from hunger, cold, insult, cruelty, and heart-break? What is swift death by lightning compared with death by slow fire at the stake? A city cemetery could contain the coffins filled by that brief Terror which we have all been so diligently taught to shiver at and mourn over; but all France could hardly contain the coffins filled by that older and real Terrorâthat unspeakably bitter and awful Terror which none of us has been taught to see in its vastness or pity as it deserves.
âMark Twain, A Connecticut Yankee in King Arthur's Court
-1
Apr 13 '20
If we're talking about terror, then you should read the Great Terror page on Wikipedia where Stalin was cleansing the society and was shooting people left and right.
0
u/emisneko Apr 13 '20
lol you are like little baby
0
Apr 13 '20
No, I'm not an American, so I know history much better than you who just listened and read some biased bullshit.
0
2
u/emisneko Apr 13 '20
-1
Apr 13 '20
Oh, so communism has fewer million deaths, so it's good now.
1
u/emisneko Apr 13 '20
didnât listen to it huh
0
Apr 13 '20
I did
0
u/emisneko Apr 13 '20
oh so youâre just lying to misrepresent its content, very cool
1
Apr 13 '20
No, they didn't say communism is good. But it seems you're defending it in some way. At least I wonder what's the point of giving a link to that video.
1
u/emisneko Apr 13 '20 edited Apr 13 '20
I can only conclude that you didn't comprehend what was said
the point is that comparing death counts is dumb bullshit and social murder is ignored
1
Apr 13 '20
Reddit communists coming out in force to attack you. Keep fighting the good fight against authoritarian leftism.
0
0
u/kamjam21xx Apr 13 '20
Do not over-abstract.
Abstract repeated code that can be generic.
Not everything needs to be a class.
Make generic class functions static.
Pass by reference or pointer.
Use mathematical identities to replace logic.
-8
Apr 13 '20
Yeeeeeeaaaaaahhhhhhhhhhhh they didnât turn out to be as useless as the gentlemen pictured thought...
-8
-7
0
227
u/M_D_Drag Apr 12 '20
I don't know the actual history of this pic, but i somehow got the joke...damn.