Details
Joined devRant on 11/24/2016
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
When top level guys look down they see only shit... 💩
When bottom level guys look up they see only assholes.. 👍7 -
"A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila." - Mitch Ratcliffe
-
This code review gave me eye cancer.
So, first of all, let me apologize to anyone impacted by eye cancer, if that really is a thing... because that sounds absolutely horrible. But, believe me, this code was absolutely horrible, too.
I was asked to code review another team's script. I don't like reviewing code from other teams, as I'm pretty "intense" and a nit-picker -- my own team knows and expects this, but I tend to really piss off other people who don't expect my level of input on "what I really think" about their code...
So, I get this script to review. It's over 200 lines of bash (so right away, it's fair game for a boilerplate "this should be re-written in python" or similar reply)... but I dive in to see what they sent.
My eyes.
My eyes.
MY EYES.
So, I certainly cannot violate IP rules and post any of the actual code here (be thankful - be very thankful), but let me just say, I think it may be the worst code I've ever seen. And I've been coding and code-reviewing for upwards of 30 years now. And I've seen a LOT of bad code...
I imagine the author of this script was a rebellious teenager who found the google shell scripting style guide and screamed "YOU'RE NOT MY REAL DAD!" at it and then set out to flagrantly violate every single rule and suggestion in the most dramatic ways possible.
Then they found every other style guide they could, and violated all THOSE rules, too. Just because they were there.
Within the same script... within the SAME CODE BLOCK... 2-space indentation... 4-space indentation... 8-space indentation... TAB indentation... and (just to be complete) NO indentation (entire blocks of code within another function of conditional block, all left-justified, no indentation at all).
lowercase variable/function names, UPPERCASE names, underscore_separated_names, CamelCase names, and every permutation of those as well.
Comments? Not a single one to be found, aside from a 4-line stanza at the top, containing a brief description of that the script did and (to their shame), the name of the author. There were, however, ENTIRE BLOCKS of code commented out.
[ In the examples below, I've replaced indentation spacing with '-', as I couldn't get devrant to format the indentation in a way to suitably share my pain otherwise... ]
Within just a few lines of one another, functions defined as...
function somefunction {
----stuff
}
Another_Function() {
------------stuff
}
There were conditionals blocks in various forms, indentation be damned...
if [ ... ]; then
--stuff
fi
if [ ... ]
--then
----some_stuff
fi
if [ ... ]
then
----something
something_else
--another_thing
fi
And brilliantly un-reachable code blocks, like:
if [ -z "$SOME_VAR" ]; then
--SOME_VAR="blah"
fi
if [ -z "$SOME_VAR" ]
----then
----SOME_VAR="foo"
fi
if [ -z "$SOME_VAR" ]
--then
--echo "SOME_VAR must be set"
fi
Do you remember the classic "demo" programs people used to distribute (like back in the 90s) -- where the program had no real purpose other than to demonstrate various graphics, just for the sake of demonstrating graphics techniques? Or some of those really bad photo slideshows, were the person making the slideshow used EVERY transition possible (slide, wipe, cross-fade, shapes, spins, on and on)? All just for the sake of "showing off" what they could do with the software? I honestly felt like I was looking at some kind of perverse shell-script demo, where the author was trying to use every possible style or obscure syntax possible, just to do it.
But this was PRODUCTION CODE.
There was absolutely no consistency, even within 1-2 adjacent lines. There is no way to maintain this. It's nearly impossible even understand what it's trying to do. It was just pure insanity. Lines and lines of insanity.
I picture the author of this code as some sort of hybrid hipster-artist-goth-mental-patient, chain-smoking clove cigarettes in their office, flinging their own poo at their monitor, frothing at the mouth and screaming "I CODE MY TRUTH! THIS CODE IS MY ART! IT WILL NOT CONFORM TO YOUR WORLDLY STANDARDS!"
I gave up after the first 100 lines.
Gave up.
I washed my eyes out with bleach.
Then I contacted my HR hotline to see if our medical insurance covers eye cancer.32 -
@dfox i have a devRant Idea.
Achievements - Kind of like Xbox achievements etc ...
For example: (Bronze, Silver, Gold, Platinum)
Total Likes: 2k, 5k, 10k, 25k
Likes On a post: 100, 250, 500, 1000
Likes on a comment: 10, 25, 50, 100
Total Rants: 15, 50, 100, 500
Total Comments: 50, 150, 400, 1000
Weekly Rant: Top 10, Top 5, Top 3, Number 1
Monthly Rant (most popular rants that month): Top 10, Top 5, Top 3, Number 14 -
Is there any Vue.js tutorial that show you step by step how to build a full aplication with database interaction?
We are building a page with inventory features in Vue.js and would be nice to have a reference.
So far all the tutorials and articles I've seen shows only the classic "app" with some limited features.2 -
Another year is ending,slowly, without much of a hassle.
Here's to all those performers who are still waiting for the phone to ring, to all those students who thought they would be earning by the year end. Here's to that father who couldn't get his dying child to have one meal with him. Here's to that daughter who could not inform her imprisoned father that she has made it to the final. Here's to that 70 year old man who is still waiting for his son to return from the dead, to that 12 year old child whose parents just split up, to that girl who thought winter would be unbearable. Here's to that silent lover who is yet to tell the girl that he exists, to that girl whose new year text to her crush failed to yield more than a blue tick. Here's to that couple who had their child, to that scientist whose data sets are turning out to be promising, to that scholar who made it to the last of the Interview rounds.
Here's to that cancer patient who went into remission.
Here's to that boy who got a Hi message from his crush, to that girl who is getting married.
Here's to all those promises and resolutions. Once again. The ones we couldn't keep,and the ones we kept. Here's to that promise that our GPA shall rise again,that all the incomplete MOOC courses will someday be done.
Here's to the beauty of fantastic beasts, Star Wars, sense8, Westworld and all the films and TV shows that made us happy.
Here's to life that goes on. Uninterrupted. Fearless. Still.
Happy New Year2 -
Looking for a job as a deveoper be like:
Job title: car driver
Job requirements: professional skills in driving normal- and heavy-freight cars, buses and trucks, trolley buses, trams, subways, tractors, shovel diggers, contemporary light and heavy tanks currently in use by NATO countries.
Skills in rally and extreme driving are obligatory!
Formula-1 driving experience is a plus.
Knowledge and experience in repairing of piston and rotor/Wankel engines, automatic and manual transmissions, ignition systems, board computer, ABS, ABD, GPS and car-audio systems by world-known manufacturers - obligatory!
Experience with car-painting and tinsmith tasks is a plus.
The applicants must have certificates by BMW, General Motors and Bosch, but not older than two years.
Compensation: $15-$20/hour, depends on the interview result.
Education requirements: Bachelor's Degree of Engineering.41 -
My colleague sent me this. Think before you act!
Hi Bob,
This is Alan next door. I’m sorry buddy, but I have a confession to make to you.
I’ve been riddled with guilt these past few months and have been trying to pluck up the courage to tell you to your face but I am at least now telling in text as I can’t live with myself a moment longer without you knowing.
The truth is, I have been sharing your wife, day and night when you're not around.
In fact, probably more than you, particularly in the mornings after you’ve left for work.
I haven’t been getting it at home recently, but that's no excuse I know.
I can no longer live with the guilt and I hope you will accept my sincerest apologies.
My wife has known for some time now and I’ve promised her that it won't happen again.
Regards, Alan.
Bob, feeling anguished and betrayed, immediately went into his bedroom, grabbed his gun, and without a word, shot his wife twice in the head, killing her instantly.
He returned to the lounge where he poured himself a stiff drink and sat down on the sofa.
He took out his phone to respond to the neighbour's text and saw he had another message:-
Hi Bob,
This is Alan next door again.
Sorry about the slight typo on my last text, I expect you worked it out.
Anyway, but as I’m sure you noticed, my predictive text changed ‘WiFi’ To ‘Wife’.
Hope you saw the funny side of that.
Regards, Alan.9 -
Never had one due to this trick I borrowed from an old friend.
So we all know about those meetings where its all crap flying around right?.
First go in there with your alarm clock set on vibration every 7 minutes(trust me on this-makes you look important and you ought to be somewhere else)
Actually the alarm is a reminder that you need to bring yourself back online.
At this point just listen to the speaker for a couple of seconds(especially if its marketing dept) and being the engineer your are; rephrase parts of their presentation in a question-comment hybrid( at this point you're the wisest looking person in the room)
Now go back to thinking about that pizza slice you left in the fridge as they discuss the "lean production" methods that they can use based on "your opinion"..
To more happy meetings..cheers3