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
Search - "style guide"
-
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 -
Why is the contributing manual of your open source project more thoughtfully cultivated than your code style guide and testing procedure?
Why the fuck do you care about the message in my PR, or even merge vs rebase of commits, when your spaghetti-tomatosource is so richly saturated with critically minced bugmeat?
Why are you standing there, shouting at me about your convoluted rules, in your little brown uniform? Why do I feel like the enemy when I contribute a useful fix, something which makes the code work better?
You know what, fuck all of you, you jilted acetous neckbeards, I will deploy my secret weapon, I will bypass the power you hold over your tiny fascist digital dominions.
If you play it like this, I will summon the nefarious vile side of Open Source. I will usurp your throne. I will stab out your crying eyes, rip out your conceited tongue, impale your lonely heart.
Tremble before me! I wield the almighty, legendary Fork!
The king is dead, long live the king!5 -
Client: You are bad developers. Your code has bugs and the site isn't even pretty. And why is it so damn expensive??
Us: ...
Same client (a month later): I need this campaign landing page with the option to register and an admin for user management. It should be done till the day after tomorrow because the URL is already in print. Here's the catalogue (in .pdf) in which it will appear. Use it as a style guide.
FUCK YOU!2 -
I've seen several rants about dumb/useless teachers, college and the CS degree studies; today is a good day to vent out some "old" memories.
Around two semesters ago I enrolled in a Database seminar with this guy, a tall geek from the 80's with a squeaky voice, so squeaky mice could had an aneurysm if they listened to him.
Either way this guy was a mess, he said he was an awesome coder, that we were still "peasants" when it came to coding, that relational databases had nothing on him since he was an awesome freelancer and did databases every day, that we had to redo the programming course with him and with his shitty, pulled out of the ass own C++ style guide with over 64 different redacted rules.
He gave us sample code of "how it should be done" in Java...it ain't my favorite language but fuck me a fucking donkey could have written better code with his ass!! He even rewrote Java's standard input function and made it highly inefficient. He still wrote in a structural paradigm in OOP languages! And he dared to make this code reviews were he would proyect someone's code and mock it in front of the class as he took off points, sometimes going to the negative realm (3,2,1,0,-1...)
But you know what's shittier? That he actually didn't even attend, 90% of the time, it was literally this:
> Good morning class
> Checks attendance. . .
> I'll be back, I'm going to check in...
> 1 hour 45 minutes later (class was 2 hrs long) - comes back
> do you have any doubts?
> O.o no...? I'm ok.
> We're done
Not only that, he scheduled from 4 to 17 homeworks throughout the week, I did the math, that was around 354 files from everyone; of course he didn't check them, other students from higher semesters did and they gained each point taken from students making students from lower semesters get the short end of the stick.
How did I pass? He didn't understood my code or database schema and he knew he couldn't fail me as he had no ground to stand on.
Thanks for listening, if you got to the end of this long ass post and had a similar experience I'd love to read it.13 -
If your language supports private member variables
And it's not part of the language style guide
DONT START PRIVATE MEMBERS WITH AN UNDERSCORE.
Shit is ugly as fuck.17 -
So there's this developer I work with. Let's call him Kevin.
I am a UX designer, former Developer from IBM - but I really love design, so I made the switch. My background however, usually makes working with Developers easy.
But not this guy! I provided a clickable prototype complete with code to easily inspect with Dev tools for measurements. I provided mobile references for some screens but not all.
Kevin submits screenshots for me to review the design. Looks nothing like the prototype, so I get out my Wacom tablet and basically draw redlines over the screenshot. "No border here, 22px should be 20px, etc."
His response was:
"I need you to say exactly what you one (want?) each pages and mobile pages to look like, text size of the font, etc.
You did a lot of red marking, so I am asking for clarification."
So basically asking for red line specs. I asked a month ago if he wanted all the mobile screens, or if what I provided was enough along with the style guide. He agreed. So now I'm majorly pissed off.
Maybe it's also the fact that one of the other developers has to hold his hand, because everything he does is bad. 😡 And his lack of ability to articulate a damn sentence effectively drives me crazy. Cherry on top, I suppose.
Would love to bring this up with my boss. ♥️ And suggestions. 😍3 -
Am I the only one who doesn't judge a programmers contributions by commits or change history?
Frequently I'm always near the bottom of contributors, because I don't make a million commits when it's broken. And I don't commit lines that will likely disappear in later commits. I like to finish a function, test it, check it, rework, and then make a "made function()" commit, as apposed to:
"Wrote function()"
"Wrote unit tests for function()"
"Fixed error"
"Code cleanup"
"Style guide compliance"
"Reworked function()"
etc.
Sorry that I keep my commit history clean and ensure it builds.7 -
There's a weird joy in implementing the design style guide for a new project.
Now, if only the designers would stop making changes to it I would be so happy.5 -
One thing you learn after a few years in IT and some languages is that there is no problem with most languages.
BUT
Ugly code is ugly code! Has half of the devs I have been working with never heard of a style guide? Is it so long of a read that they just skip it.
I have flashback of variables being called "a", "b", "c" and/or methods being called "method_alfa" in production code.
In my opinion, repeatedly sh*ting all over a style guide is a reason for getting fired.1 -
*me browsing through my company's code style guide*
"You must not use spaces for indentation" - awesome!
"Files must not contain more than 4000 lines of code" - wtf?9 -
For the last time, SLOC is not a measure of anything.
Have too many, the code probably isn't DRY.
Have too few, you probably don't follow a style guide and have 120 char lines because you invented "oneliners" which you were so proud of that you had to put it in there.
Have just the right amount, and the code likely suffers from both of these at the same time.8 -
Look, normally I don't give a shit how others code, but when the company's style guide is literally just the statement "use eslint", and I have to do code reviews...we will start to have problems.1
-
Schrodingers font size:
When you follow the directions given in the style guide, but it still doesn't match the mockups.
The chosen font size can be considered both wrong and right until examined by a member of the design team. -
// first rant
So this isn't really a "dev" rant but I'm a developer taking my first ever design class. It's a senior level, group based class where we design a mobile OS from the ground up, using any inspiration we like. I love it because I'm the developer and designer for all of the Android apps I've worked on so far. I get to practice my design skills and have a portfolio addition. Neat! It's a pretty easy class too.
But my group. Oh God my group.
I spent a week and a half designing the style guide and it was jam packed with anything we'd need. Typography, icons, rationales, you name it!
But noooo, they can't use it because it's not in sketch. As a Windows user, this is infuriating. So three weeks go by and all this work is done that's SUPER INCONSISTENT. Bad colors, elements off by 3px... I mean even the font sizes are just 1 or 2 off. Seriously, I wish I could just be frank with them and tell them to put in the 1% effort to make it right. It's really not that hard. I just don't want to screw up the peace in my group..2 -
I️ cannot tell if it’s good or bad to have my own coding style guide that might go against convention6
-
My cs program at university forces a style "guide", but the best thing is, in order to comply you'd have to rewrite all the default classes. Because apparently, an if statement followed by a single statement needs curly braces.
You'd think these fuckers would know what they're talking about...4 -
I'm shitting there hammering out some code butchering some real problems when I suddenly realise I'm surrounded. I look around and yes it's the bloody committee.
The committee is what I call the rest of the department and it is dominated by the old guard which comprises of the programmers that have been around for longer.
None of the old guard can program particularly well but because they had been around the longest they'd all grown senior. The committee had free reign but anyone else doing anything differently has to get approval from the committee.
The only way to code otherwise was to copy and paste existing code then to primarily rename things. If anyone did anything that hadn't been seen before then it would have to be approved by the committee. Individual action was not permitted unless you were old guard.
I swept my headphones away expecting it to be something unimportant. It was.
First things first they announce. We're going to add extraneous commas to the last element of all possible lists separated by comma including parameters or so they say. Ask but why so I do.
Because the language now supports it. They added support for it so it must be the right way someone proclaimed. Does it? I didn't realise we were waiting for it. Why do we want it though?
Didn't you hear? It's all over the blogosphere. It massively improves merge requests. But how I ask?
Five minutes later I grow tired of the chin stroking, elbow harnessing, slanted gazes into the yonder and occasionally hearing maybe its because and ask if they mean when you for example add an element the last element registers as changed from adding a comma. Turns out that's all it is.
How often do we see that tiny distraction and isn't it pointless to make the code ugly just for a tiny transient reduction in diff noise I ask. Everyone's stumped. This went on and on and got worse and worse. But it makes moving things around easy half of them say in unison like the bunch of slobs that they are. I mean really. It doesn't make expanding and contracting statements from multiline to single line easy and it's such a stupid thing. Is that all they do all day? Move multi-line method parameters up and down all day? If their coding conventions weren't totally whack they wouldn't have so many multiline method prototypes with stupid amounts of parameters with stupidly long types and names. They all use the same smart IDE which can also surely handle fixing the last comma and why is that even a concern given all the other outrageously verbose and excessive conventions for readability?
But you know what, who cares, fine, whatever. Lets put commas all over the shop and then we can all go to the pub and woo the ladies with how cool and trendy we are up to date with all the latest trends and fashions then we go home with ten babes hanging off each arm and get so laid we have to take a sick day the following to go to the STD clinic. Make way for we are conformists.
But then someone had to do it. They had to bring up PSR. Yes, another braindead committee that produces stupid decisions. Should brackets be same line or next line, I know, lets do both they decided. Now we have to do PSR and aren't allowed to use sensible conventions.
But why, I ask after explaining it's actually quite useful as a set of documents we can plagiarise as a starting point but then modify but no, we have to do exactly what PSR says. We're all too stupid apparently you see. Apparently we're not on their level. We're mere mortals. The reason or so I'm told, is so that anyone can come in and is they know PSR coding styles be able to read and write the code. That's not how it works. If you can't adjust to a different style, a more consistent style, that's not massively bizarre or atypical but rather with only minor differences from standard styles, you're useless. That's not even an argument, it's a confession that you've got a lump of coal where your brain's supposed to be.
Through all of this I don't really care because I long ago just made my own code generators or transpilers that work two ways and switch things between my shit and their shit but share my wisdom anyway because I'm a greedy scumbag like that.
Where the shit really hit the fan is that I pointed out that PSR style guide doesn't answer all questions nor covers all cases so what do we do then. If it's not in PSR? Then we're fucked.4 -
I actually do have something to rant about!
The people I've decided to work with... are complete and utter fools. They don't want to keep updated with new practices and merely talk about awesome stuff... Let me elaborate.
The first person is someone I spent really many hours just writing with, I've helped him build on his personal project, which has now become our project (which I've done most of the work on now). He keeps writing about things that aren't fucking relevant for the current task - furthermore, he completely refuses to use any type of collaboration software in order to keep an eye on tasks we want to, and already have completed. He likes Git but doesn't provide helpful git messages, sometimes even stuff like 'forgot this'.. never any freaking description of what's actually been done! Not even after agreeing it should be done, he just doesn't understand what a helpful message is apparently.
I might be a bit special regarding wanting to follow practices, but how the fuck do you make any amount of money by being so ignorant!? He was a WP 'developer' a while ago, and has since changed to JS and are using a framework which he doesn't understand - he can't even remember what the documentation states.
So why do I 'work' with him? He knows a lot of phrases he's read in books, blogs, and the likes. That makes him really inspirational and positive and he really wants to become successful(like me!). But over the last few months, I've realized how bad he is at programming - he doesn't know basic programming concepts and have a hard time applying any sort of knowledge to his programming. If it's not pre-built, he can't use it, not even if the documentation has specific examples. He barely grasps the concept of binding data to a variable. He wouldn't know how to access it again though, it's just for the sake of binding it to some existing functionality.
The other guy really likes his old style. He hired me to maintain some application. Which has turned out to be a hell of several small tasks he needs to be finished or reworked - with no clear definition of the task. Most of the time, he'll do some initial changes, show the changes to me, vaguely explain what they do (not what he's trying to achieve) and first THEN ask me to do these changes, most often in some files that don't exist (he uses the wrong filenames so I have to guess/ask where the changes need to be made).
To top it all off, old syntax is used and don't get me started on the spaces+tabs for indenting lines... Because I've already added a great ESLint+Prettier conf and everything should be nicely formatted according to pre-defined rules.
But he won't take the time to install some plugins in his editor and I'm left with sometimes buggy, badly formatted code (the code I have to make changes with!) - that's while he several times have agreed that I can do what I want and that he even questions his own ways when looking at my changes which he calls by-the-book.
So why the motherfucking fuck do I keep working with him?
Well, he keeps paying so that's really nice - I haven't been able to properly execute the bigger tasks(which pays more) though, due to a lack of information or some badly written code I couldn't quite figure out how works (at a glance).
He also keeps talking about these new projects he wants to make.. he even has these freaking papers with descriptions and data-structures and we converse really good about these new awesome projects. He also likes cryptocurrencies(which is an interest of mine he has inflamed quite a bit) and lastly, he seems like a genuinely nice guy who I'd like to spend some time with even besides coding and work.
So now I stand here - stuck with people that make me feel like a demi-god or something because I use a git style-guide and ESLint+Prettier with the Airbnb style-guide.
What should I do? I'd really like some remote work and have a desperate need for money... So much so, that I might even have to pick up a fulltime job, in order to save my sorry ass - all because I like speaking with people who just like the thought of programming...
I'm actually quite lonely with my thoughts and they are the two only people I've had some sort of relationship with - who has an invested interest in programming/dev... I really like that, despite having to follow their thoughts as they surely can't follow mine.
Please be my friend or give me some paid work lol.
Also, I've been moving the last couple weeks - those weeks has been the most stressful of my life and have not contributed to my overall wellbeing and relations with people... It's good to be back at the computer again and be reading some devRant though!1 -
We've introduced an official coding style at my work, which is great. Visual Studio will even alert us when code isn't up to snuff.
What Microsoft didn't think to do was let me automatically apply naming conventions across entire solutions or even just projects. I got to spend a few hours today manually going through hundreds of files and and applying the style guide.
I can automatically apply brace style across an entire solution, why won't you let me do the same with naming conventions?! A few hours down, a few more to go.6 -
CollegueRant
Colleague from other departement told me, his teamlead tacitly removed all comments from the source. They have no official style guide about comments or discussed it on the team, teamlead just thinks the source should be readable enough, so that there are no comments needed.
That would make me think about quitting really fast.1 -
Framework Style Guide:
"When extending this library, please refrain from exposing too many arguments for the stages in your pipeline. Everything that could be fixed or inferred should not require additional configuration. "
Real life:
"Adjust every fucking knob and screw to stupidly specific settings for each and every use case or gravity itself will stop working. Heed this warning for you will not have another chance. "
That's it. More a vent than a rant. -
How do you guys deal with PRs where things just don't go in and you're always making the same comments and suggestions?
We have a fairly experienced guy in the team who doesn't seem that familiar with the language (Kotlin), despite having now used it for almost a year. We're constantly making the same comments on code not using the correct syntax (basic things like val vs var) or following the style guide and after a lot of grumbling the changes are made, but the same issues are present in the next PR.
He also keeps doing things their own way, even if as a team we've reached consensus on a particular design pattern to follow, or way to solve a problem. When you mention this, you just get a "Hmm okay" but nothing changes. It's like things just go in one ear and out the other.
Even as the reviewer this is really frustrating and demoralising. PRs have loads of comments which makes you feel like you're being picky, and they take forever to get approved and merged.
I even often find myself effectively feeling bullied into approving once most of the main comments are addressed, because you're talking the brick wall that isn't yielding - and none of us are happy with the quality of the code going in. A couple of us are even starting to think "I'm just going to have to accept this and then fix it myself later", which is just not a healthy approach.
Now I'm blessed with an amazing manager who is well aware of the problem and knows from his own experience that this guy is genuinely problematic to work with. We're working towards a solution but I was wondering if anyone here has had a similar experience and how you worked towards solving it?
I'm a little at my wit's end :/9 -
Refactoring code to meet style guide..... 20 bucks says outside of my code reviews no one will look at it for years.
-
So we have duplicate code because dumb devs thinks Bootstrap (4) is kick-ass for mobile. 😒 Can't do jack with their tables.
I told them to use Flexbox instead. Bootstrap (even 4) is antiquated and there's better options.
My recommendation is to use Flexbox Grid with React to build a modular living style guide with built in unit testing for styles and interactions.
Basically got told that my opinion is just an opinion and is the same as using Bootstrap. 😭
Anyone have some solid "facts" on Bootstrap I can use in the long run? We haven't even launched anything and we're already in technical debt because of this stupid framework decision. Someone please help. 😞3 -
I have become the guy that sends emails to the rest of my team telling them that their code doesn't follow our team's style guide.2
-
I loosely set aside Friday evening, Sunday and Monday for a rush job that was supposedly urgent. Monday I was sent the style-guide. It's mandatory to be written with bootstrap. Tuesday 10am, no copy, no images, no idea where the code will go or how it's context's global CSS will cascade over mine. Visual designer says the logo they provided me isn't crisp enough. How many grown adults does it take to screw in a lightbulb? 9?
-
My most consistent enemy at work is this fucking system I have to work in, holy shit. Not only is there no default support for shit you would really think there should be, no real control over the interfaces with the UI, and the far too complicated method they use to magically make said interfaces, but we also have to use their build environment to build this shitty thing. So builds take anywhere from 4 to 12 minutes a pop and ridiculous style guide will stop the build, no questions asked, for dumb violations like spaces between if and (. And it doesn't catch these, sometimes, until 7 or 8 minutes in. I have wasted so much time on this. And seeing as we work in 2 week sprints that are really 7 to 10 day sprints based on whatever hair goes up my bosses ass and have to deliver feature complete in those two weeks, I can't really afford all this nonsense. I used to joke about having an alcohol problem, but I think I actually may be developing one at this point.
-
We decided to use ESlint as our style guide. Then comes this guy and starts adding exceptions. Dude if you keep adding exceptions, there's no need for a guide anyways.
-
!!rant
Why the fuck would you bother creating a style guide if you don't adhere to it even a bit in creating mockups?!
Sure as hell I can code what you want, but you gotta stick to the agreed guidelines, dude! We can't keep adding *slightly different* elements, it'll lose its purpose! -
Okay question, I know it doesn’t matter for personal use but I’m not sure what the general consensus is in a team setting.
If I’m using a css framework in a project, and I customize it to match my style guide, does that require documentation usually?
Mainly speaking on changing the colors here for the most part I’m not going Rambo on the original files.
I’m asking in case I catch some freelance gigs; I don’t want to be clueless if there’s a few others on the project as I’ve only done solo work.2 -
Today it took me *five* commits and nearly 2 hours to tidy up a module before doing a tiny 5-minute change.
I could have just done my change but that thing was so messy, I first had to straighten things up.
It's not that I didn't expect that, the module was mainly done by my dearest co-worker who's code usually causes me anaphylactic shocks.
But I'm always amazed how hard it can be to follow a style guide, and ours is really small anyway.2 -
This more how I got back into dev.
I made a mistake and got out of dev for a year or so. What hooked me back in was hearing our C# lead missing that no applicants were passing his C# screening test. I'd never written a line of C# in my life but I had done C++ and Java, so I gave it a go, and apart from one small issue, he said my attempt was the best he'd seen in that recruitment drive. So I started picking up tickets and the rest is history.
The one small issue was doing `if (something == false)` instead of `if (!something)`. Where I work now the C# style guide actually recommends the former!