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
Kernel Sanders
Sep 15, 2020
i tried reading it but I’m pretty sure “uncle” bob martin hasn’t written production code since the tracy ullman simpsons.

just terrible

Adbot
ADBOT LOVES YOU

Cybernetic Vermin
Apr 18, 2005

it is kind of outdated going by the section "functions should do one thing", which seems like good advice, but he is thinking of avoiding functions that do *multiple* things, where the 2021 typical problem is rather functions/classes/proxies/abstractions that do zero things.

NoneMoreNegative
Jul 20, 2000
GOTH FASCISTIC
PAIN
MASTER




shit wizard dad

BEAUTIFUL CLEAN CODE, JUST THE BEST

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
here is the only clean code in existence, penned right here for you to witness

code:

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
the above code is released copyright YOSPOS under the affero gnu public license version 8

akadajet
Sep 14, 2003

Cybernetic Vermin posted:

it is kind of outdated going by the section "functions should do one thing", which seems like good advice, but he is thinking of avoiding functions that do *multiple* things, where the 2021 typical problem is rather functions/classes/proxies/abstractions that do zero things.

why just call a function that returns a result when you can have a big 'ol CQRS gateway call it for you??

akadajet
Sep 14, 2003

my favorite is when developers write all these abstractions to make automated testing possible but don't write any automated tests that benefit from it. then when you try to test it you find out the abstractions are kind of busted anyways.

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

here is the only clean code:

code:
10 PRINT "PENUS  ";
20 GOTO 20

Truman Peyote
Oct 11, 2006



at my first programming job the boss once herded us into the meeting room for a "lunch and learn" where he played a recording of a conference talk uncle bob gave. literally the first 20 minutes or so were him going on some kind of strange tangent about how you have two parents, and four grandparents, and eventually there's a generation of your ancestors that is bigger than the total number of people alive at the time, isn't that weird? this didn't lead anywhere, that was actually how it concluded.

the good blog post: https://qntm.org/clean

Kernel Sanders
Sep 15, 2020

what, you don’t like “public class SetupTeardownIncluder”

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
I'm disappointed this thread was posted in satire of the clam code thread, wth guys this isn't even funny

Truman Peyote
Oct 11, 2006



iirc uncle bob also endorses doing "code kata," or typing out the same simple programs over and over in order to practice typing for loops and variable definitions

Best Bi Geek Squid
Mar 25, 2016
And we then did the war on clean, beautiful code, and we are putting — and you see it better than almost anybody — our coders. They’re all back to work, and they’re going back to work. Clean code, clean code. Nobody thought that was going to happen so fast, either.

I just left San Francisco, and I looked at those trains and they’re loaded up with clean code — beautiful clean code.

Kernel Sanders
Sep 15, 2020

Truman Peyote posted:

iirc uncle bob also endorses doing "code kata," or typing out the same simple programs over and over in order to practice typing for loops and variable definitions

he endorses a lot of terrible ideas, and not just terrible programming ideas

Doom Mathematic
Sep 2, 2008

Truman Peyote posted:

iirc uncle bob also endorses doing "code kata," or typing out the same simple programs over and over in order to practice typing for loops and variable definitions

For a good laugh, read the first chapter of Clean Architecture. He has someone do this with a Roman numerals serializer, writing out the same trivial function once per day for six days, alternating between TDD and non-TDD, in order to demonstrate that TDD is faster. TDD does indeed work out to be about 5 minutes faster, because after six days it's taking the guy ~20 minutes to write his function out with TDD, versus ~25 without.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
code katas are the sort of thing i would expect someone who has spent a lot of time talking to programmers but very little time actually themselves programming to come up with. the basic premise does kinda make sense: the most effective way to be able to solve a problem quickly is to have already solved it before, so practicing solving a wide variety of problems could potentially be useful? the actual problems that people propose solving for practice seem completely worthless and potentially counterproductive. doing the same one-hour task in five different ways might help you learn which approach is best for that sort of one-hour task, but that's unlikely to also be the best approach for something nontrivial. most of the time you'll have just spent five hours doing nothing useful and learning nothing.

i've also seen people use the term "code kata" for timeboxed rabbit holing where you dive into something that you don't expect to be directly worth the time you spent on it, but you hope that you'll learn something useful in the process. this seems like a completely different idea to me and i dislike that it sometimes gets conflated.

Kernel Sanders
Sep 15, 2020
he’s like this peddler of vitamins that skew every problem as being solvable by taking vitamins. it’s technically correct but the impact is no where near what he promises.

like, yeah, writing tests is good and can help when done properly but have you seen a bad test suite? it’s a black hole of productivity since no one trusts the test yet the devops god requires his coverage blood tithe so everyone puts in nonsense tests.

Cybernetic Vermin
Apr 18, 2005

i have never been even tangentially involved in a project where tdd was very successful, and to my eyes at least it always seems to create a vast number of tests at the wrong level of granularity. i.e. unit testing functions (or tiny classes) in isolation failing to reveal anything but the most trivial bugs you're very likely to find anyway, where in my experience the hard to find, subtle, and dangerous are ones of composition/layering.

at the very least if unit tests get written at the *expense* of functional tests with a side of random testing/fuzzing then i think it is a bad idea.

echinopsis
Apr 13, 2004

by Fluffdaddy

Kazinsal
Dec 13, 2011



one of the benefits of only writing code where it's reasonably expected that if someone gets arbitrary access to it they've already ruined all layers of security is that I don't have to wonder "what happens if a user sneezes on the fourth of march at 18:33:19 UTC when jupiter is in retrograde" and other insane frontend testing poo poo. if you've broken through everything and entered kernel mode then to say that you've won is an understatement

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

was going to post this, thanks for saving my time

2Fast2Nutricious
Oct 4, 2020

why does he want us to call em uncle? thats weird as hell

MrQueasy
Nov 15, 2005

Probiot-ICK

Cybernetic Vermin posted:

i have never been even tangentially involved in a project where tdd was very successful, and to my eyes at least it always seems to create a vast number of tests at the wrong level of granularity. i.e. unit testing functions (or tiny classes) in isolation failing to reveal anything but the most trivial bugs you're very likely to find anyway, where in my experience the hard to find, subtle, and dangerous are ones of composition/layering.

at the very least if unit tests get written at the *expense* of functional tests with a side of random testing/fuzzing then i think it is a bad idea.

it’s the functional tests that get out of hand and become useless the fastest. eventually people are just asserting that no exceptions are thrown… ignoring and forgetting about all the side effects involved.

the problem with unit tests is that people don’t understand what makes code easy or hard test. The purpose of unit tests for me is to be able to be able to have more confidence that my building bricks are stable, and my functional tests can focus more closely on the overall structure.

that being said, Tests First has NEVER worked for me.

tk
Dec 10, 2003

Nap Ghost
TDD works pretty well in interviews.

toiletbrush
May 17, 2010

MrQueasy posted:

that being said, Tests First has NEVER worked for me.
I write tests first for algorithmic or edge-case heavy stuff where I know what the outputs should be and it's something I hate, eg pretty much anything that touches dates or trigonometry

its also great when you've got a bug and want to prove that you've reproduced, understood & fixed it, but that tends to be more functional/integration level

ultravoices
May 10, 2004

You are about to embark on a great journey. Are you ready, my friend?
being a 150 wpm wonder at typing your well practiced function doesn't make the code any better.

Adbot
ADBOT LOVES YOU

Best Bi Geek Squid
Mar 25, 2016
faster typing = faster execution speed, duh

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