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 - "no indentation"
-
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 -
So we had a dev on our team who was on a performance improvement plan, wasn't going to pass it, but decided to quit before it was over saving us 2 weeks.
I was ecstatic when he left (caused us hell). I knew updating his code wouldn't be great, but he was only here 6 months
"how bad could it be" - practiseSafeHex - moron, idiot, suicidal.
A little run down would be:
- Despite the fact that we use Angular 2+, one of his apps is Angular 1 ... Nobody on the team has ever used Angular 1.
- According to his package.json he seems to require both mongoDb and Cloudant (couchDb).
- Opened up a config file (in plaintext) to find all the API keys and tokens.
- Had to rename all the projects (micro services) because they are all following a different style of camelcase and it was upsetting my soul.
- All the projects have a "src" folder for ... you know ... the source code, except sometimes we've decided to not use it for you know, reasons.
- Indentation is a mess.
- He has ... its like ... ok I don't even know wtf that is suppose to be.
- Curly braces follow a different pattern depending on the file you open. Sometimes even what function you look at.
- The only comments, are ones that are not needed. For example 30+ lines of business logic and model manipulation ... no comment. But thank god we have a comment over `Fs.readFile(...)` saying /* Read the config file */. Praise Jesus for that one, would have taken me all week to figure that out.
Managers have been asking me how long the "clean up" will take. They've been pushing me towards doing as little as possible and just starting the new features on top of this ... this "code".
The answer will be ... no ... its getting deleted, any machine its ever been on is getting burned, and any mention of it will be grounds for death.6 -
The problem with my life is acceptance from others. Validation (almost wrote vladiation).
For instance, I finished my course in Advanced Java Programming a few days ago. Supposed to be a year course or some shit, finished it in two months. They told me I don't need to go to the remainder classes and I could write the examination. Got the certifications, passed with flying colours.
Well done me? No, fuck you me. "It's not through Oracle, so it's completely useless. Har har you wasted your measly salary on a course and it means nothing". You know what? Fuck you and fuck validation. I will validate myself from now on.
Anywhom, what a start to a shitty rant. Let's go over some generic points so I can finally make my avatar.
IE can suck a duck ("oooh you made it and it runs fine in every fucking browser except fucking IE - slow clap).
Chrome RAM usage can suck a duck, two times. (just generic post, don't actually give a shit - I use Firefox).
People who can't use one fucking indentation standard ("oooh two spaces, oooh three spaces, oooooh a fucking tab button... " etc) can fuck off.
That fucker who came and converted my buildings in Age of Empires with the "wolololo" priest can fuck off too.
Been reading through devRant and you know what? You guys are pretty cool5 -
This codebase reminds me of a large, rotting, barely-alive dromedary. Parts of it function quite well, but large swaths of it are necrotic, foul-smelling, and even rotted away. Were it healthy, it would still exude a terrible stench, and its temperament would easily match: If you managed to get near enough, it would spit and try to bite you.
Swaths of code are commented out -- entire classes simply don't exist anymore, and the ghosts of several-year-old methods still linger. Despite this, large and deprecated (yet uncommented) sections of the application depend on those undefined classes/methods. Navigating the codebase is akin to walking through a minefield: if you reference the wrong method on the wrong object... fatal exception. And being very new to this project, I have no idea what's live and what isn't.
The naming scheme doesn't help, either: it's impossible to know what's still functional without asking because nothing's marked. Instead, I've been working backwards from multiple points to try to find code paths between objects/events. I'm rarely successful.
Not only can I not tell what's live code and what's interactive death, the code itself is messy and awful. Don't get me wrong: it's solid. There's virtually no way to break it. But trying to understand it ... I feel like I'm looking at a huge, sprawling MC Escher landscape through a microscope. (No exaggeration: a magnifying glass would show a larger view that included paradoxes / dubious structures, and these are not readily apparent to me.)
It's also rife with bad practices. Terrible naming choices consisting of arbitrarily-placed acronyms, bad word choices, and simply inconsistent naming (hash vs hsh vs hs vs h). The indentation is a mix of spaces and tabs. There's magic numbers galore, and variable re-use -- not just local scope, but public methods on objects as well. I've also seen countless assignments within conditionals, and these are apparently intentional! The reasoning: to ensure the code only runs with non-falsey values. While that would indeed work, an early return/next is much clearer, and reduces indentation. It's just. reading through this makes me cringe or literally throw my hands up in frustration and exasperation.
Honestly though, I know why the code is so terrible, and I understand:
The architect/sole dev was new to coding -- I have 5-7 times his current experience -- and the project scope expanded significantly and extremely quickly, and also broke all of its foundation rules. Non-developers also dictated architecture, creating further mess. It's the stuff of nightmares. Looking at what he was able to accomplish, though, I'm impressed. Horrified at the details, but impressed with the whole.
This project is the epitome of "I wrote it quickly and just made it work."
Fortunately, he and I both agree that a rewrite is in order. but at 76k lines (without styling or configuration), it's quite the undertaking.
------
Amusing: after running the codebase through `wc`, it apparently sums to half the word count of "War and Peace"15 -
My friend loves Dreamweaver... And continuously says that he doesn't understand what people see in it that is so wrong... It does the job right?...... Fucking blind...
Uses a bootstrap plugin which generates HTML code for bootstrap.
I did not know this at the time.
Comes to me the night before submission.
He: Dude i need help quick! I've got the presentation tomorrow morning and bootstrap fucked up the links to my style sheets or something, my page is broken and won't work. I should have done what you did and gone for Foundation...
Me: Yeah, because the bootstrap framework definitely affects the style links...
He: help me out man, please! I can't do this anymore!
I had my submission the day after him to prepare still...
Me: Teamviewer. Now.
Log on to Teamviewer.
See what he's using to code...
Dreamweaver..... Niiiiice....
I go through the code. There are empty divs with &nbsc; in them everywhere.. some HTML elements haven't been closed, no comments, indentation seems to be completely random. All the usual shit storm of a novice web designer.
The only thing is, this guy I know knows how to indent, I've seen his previous work. Why is this so horrible then???
I ask what the hell happened, it looked like a nuclear explosion happened!
He: Yeah I'm using this great plugin for Dreamweaver which lets me click and it puts in Bootstrap elements! It's great!
........ You're blaming the bootstrap framework for affecting your links to your stylesheets, you're using an elements generator, you're not checking what the FUCK it puts into your code, not fixing the indenting, not checking the standard HTML rules are followed AND YOU WONDER WHY IT'S BROKEN???
Kill me now.4 -
I'm editing the sidebar on one of our websites, and shuffling some entries. It involves moving some entries in/out of a dropdown and contextual sidebars, in/out of submenus, etc. It sounds a little tedious but overall pretty trivial, right?
This is day three.
I learned React+Redux from scratch (and rebuilt the latter for fun) in twice that long.
In my defense, I've been working on other tasks (see: Alerts), but mostly because I'd rather gouge my freaking eyes out than continue on this one.
Everything that could be wrong about this is. Everything that could be over-engineered is. Everything that could be written worse... can't, actually; it's awful.
Major grievances:
1) The sidebars (yes, there are several) are spread across a ridiculous number of folders. I stopped counting at 20.
2) Instead of icon fonts, this uses multiple images for entry states.
3) The image filenames don't match the menu entry names. at all. ("sb_gifts.png" -> orders); active filenames are e.g. "sb_giftsactive.png"
4) The actions don't match the menu entry names.
5) Menu state is handled within the root application controller, and doesn't use bools, but strings. (and these state flags never seem to get reset anywhere...)
6) These strings are used to construct the image filenames within the sidebar views/partials.
7) Sometimes access restrictions (employee, manager, etc.) are around the individual menu entries, sometimes they're around a partial include, meaning it's extremely difficult to determine which menu entries/sections/subsections are permission-locked without digging through everything.
8) Within different conditionals there are duplicate blocks markup, with duplicate includes, that end up render different partials/markup due to different state.
9) There are parent tags outside of includes, such as `<ul>#{render 'horrific-eye-stabbing'}</ul>`
10) The markup differs per location: sometimes it's a huge blob of non-semantic filthiness, sometimes it's a simple div+span. Example filth: section->p->a->(img,span) ... per menu entry.
11) In some places, the markup is broken, e.g. `<li><u>...</li></u>`
12) In other places, markup is used for layout adjustments, such as an single nested within several divs adorned with lots of styles/classes.
13) Per-device layouts are handled, not within separate views, but by conditionally enabling/disabling swaths of markup, e.g. (if is_cordova_session?).
14) `is_cordova_session` in particular is stored within a cookie that does not expire, and within your user session. disabling it is annoying and very non-obvious. It can get set whether or not you're using cordova.
15) There are virtually no stylesheets; almost everything is inline (but of course not actually everything), which makes for fun layout debugging.
16) Some of the markup (with inline styling, no less) is generated within a goddamn controller.
17) The markup does use css classes, but it's predominately not for actual styling: they're used to pick out elements within unit tests. An example class name: "hide-for-medium-down"; and no, I can't figure out what it means, even when looking at the tests that use it. There are no styles attached to that particular class.
18) The tests have not been updated for three years, and that last update was an rspec version bump.
19) Mixed tabs and spaces, with mixed indentation level (given spaces, it's sometimes 2, 4, 4, 5, or 6, and sometimes one of those levels consistently, plus an extra space thereafter.)
20) Intentional assignment within conditionals (`if var=possibly_nil_return_value()`)
21) hardcoded (and occasionally incorrect) values/urls.
... and last but not least:
22) Adding a new "menu sections unit" (I still haven't determined what the crap that means) requires changing two constants and writing a goddamn database migration.
I'm not even including minor annoyances like non-enclosed ternaries, poor naming conventions, commented out code, highly inefficient code, a 512-character regex (at least it's even, right?), etc.
just.
what the _fuck_
Who knew a sidebar could be so utterly convoluted?6 -
After using StackOverflow for years, it makes me mad that the devRant community hates on it saying "i get downvotes", "people are assholes". But when you go ahead and see those questions, the Poster took less that 15 seconds to copy/paste their shitcode with poor indentation, no context, no question, no expectation description, and no result description.
YET, THEY DEMAND FREE HELP and for people willing to help, to BREAK THEIR FUCKING EYES reading your non indented and/or non preformatted crap of shitcode
Listen here you little shit, if you don't take at least fucking 5 minutes to let me know what the fuck are you trying to do, what the fuck have you tried, and what the FUCKING SHITFUCK you expected to happen, THEN DON'T GO RANTING LIKE A PRE-PUBERT GREASY KID ON WHY YOUR FUCKING QUESTION GOT DOWNVOTED.
The problem is YOU AND YOUR LACK OF CONSIDERATION TOWARDS OTHER DEVELOPERS, <BOLD>WHO ARE WILLING TO DO FIX YOUR SHITCODE FOR FREE</BOLD>
It took me a while to understand that, when I started posting years ago. But once I learned, it was extremely helpful.
SO SHUT THE FUCK UP, BE HUMBLE, AND WRITE A PROPER FUCKING QUESTION.
WHY AM I RANTING ABOUT THIS, YOU ASK? WELL SOME FUCKTARD JUST POSTED "java - if(Plot Number == booked)then change the color of CardViewBackground color and text color Recyclerview Android", AND THE FUCKING BODY IS JUST A COPY PASTE OF A SHITCODE JAVA CLASS.
WHAT THE FUCK DO YOU EXPECT TO GET WITH THIS???
OOOOHHHHH BUT, I'M SURE AS FFFUUUCKKKK HE'S GOING TO CRY TO DEVRANT ABOUT HIS FUCKING QUESTION GETTING 3 DOWNVOTES.12 -
I love group projects.
There is no greater feeling than, after you set up the repository with the first code files, your team mate changes the indentation and commenting style in every file to his own style without even discussing the general coding style rules in the group first.
Fucking awesome start.
Go eat a sack of unwashed hobo balls you filthy cunt.3 -
So I once had a job as a C# developer at a company that rewrote its legacy software in .Net after years of running VB3 code - the project had originally started in 1994 and ran on Windows 3.11.
As one of the only two guys in the team that actually knew VB I was eventually put in charge of bug for bug compatibility. Since our software did some financial estimations that were impossible to do without it (because they were not well defined), our clients didn't much care if the results were slightly wrong, as long as they were exactly compatible with the previous version - compatibility proved the results were correct.
This job mostly consisted of finding rounding errors caused by the old VB3 code, but that's not what I'm here to talk about today.
One day, after dealing with many smaller functions, I felt I was ready to finally tackle the most complicated function in our code. This was a beast of a function, called Calc, which was called from everywhere in the code, did a whole bunch of calculations, and returned a single number. It consisted of 500 or so lines of spaghetti.
This function had a very peculiar structure:
Function Calc(...)
...
If SomeVariable Then
...
If Not SomeVariable Then
...
(the most important bit of calculation happened here)
...
End If
...
End If
...
End Function
But for some reason it actually worked. For days I tried to find out what's going on, where the SomeVariable was being changed or how the nesting indentation was actually wrong and didn't match the source, but to no avail. Eventually, though, after many days, I did find the answer.
SomeVariable = 1
Somehow, the makers of VB3 though it would be a good idea for Not X to be calculated as (-1 - X). So if a variable was not a boolean (-1 for True, 0 for False), both X and Not X could be truthy, non-zero values.
And kids these days complain about JavaScript's handling of ==...7 -
Refactoring code of somebody who left and:
- Plagued the code with TYPOS (milions of them but ok I can live with those... to a certain point)
- Used global variables by default.... of course even where they're not needed
- Used comments only in parts of code where... well they're not needed, important ones are of course left out
- Did not indent code. 3..2..1... Did not FUCKING indent code properly and when he did... did WRONG!
- Instead of indentation he used commented line with multiple ==== signes.... so far top is 60 consecutive lines with olny ==== again no apparent pattern here
- Did not follow a fucking standard in variable naming... no camle casing... there are varaibles assigned multiple times to "temp" variables without no reason just for the sake of wasting resources on the system I guess
This is just the beginning of the review but I already want to change job, die, scream, cry... not in any specific order.10 -
So we are in computer lab with some bitch ass c++ program on the board,,its approx. 150 sloc with lot of if's and else's...halfway into the session my friend rolls on his chair comes to my system asking for help, i say sure dude why not.
So we both roll to his system and that bastard has 0 indentation,a set of brackets for every if else even for non-compound statements with every bracket in a line of its own.......
With great difficulty of restraining myself from punching him in the face,,,i politely ask him"Have you ever coded in python"
He says no
I say "that was a rhetorical question"
Everyone around us bursts into laughter and that poor lad still has no idea what just happened
Python should be made compulsory for fags like these,, they'll know the meaning of indentation only then7 -
TL.DR.: Emojis in commit messages + bad commit messages made by Microsoft™ employees.
Yes, I'm looking at you Microsoft. It would be helpful if I can, you know, understand your commit messages instead of trying to guess wtf _that_ emoji means. That is, if it is the same emoji on my machine. We didn't figure that one out yet. And no, "Some 💄 changes ✨" is not a good commit message, even if you interpret it correctly (which depends on your emoji icon set).
idk about you, but that shitty 💄 emoji tends to be (see image) and I happen to associate that with an XLR audio cable. I had to ask someone else to understand a commit message; a message supposed to be explicit—stating what you changed and optionally why you changed it (you can off-load that part to an issue tracker).
Furthermore, that "Some 💄 changes ✨" commit did none of that. "I made cosmetic changes somewhere for some reason without linking to an issue." If you didn't catch that little detail yet: "COSMETIC CHANGES" is vague as fuck. What is a cosmetic change?
* Does a cosmetic change mean adjusting indentation?
* Does it mean deleting unnecessary abstraction to make the code more readable?
* Does it mean refactoring code to add that beauty factor?
* Does it mean all of the above? Or perhaps a specific combination of these?
Human communication is shit enough, don't make it worse than it already is.22 -
So...
I'm looking for my first job as a web developer. I kept seeing these rants about how horrible and frustrating job searching is, all of which I thought were greatly exaggerated. They're all just jokes and memes, right?
Nope.
Every fucking meme seems to be true.
- Junior developer with +4 years of experience, expert in their field - check!
- Listing requirements for 6 different jobs under "Full-stack developer" - check!
- "Expert developer required ASAP" - $10/hour - check!
- 100% remote ... *scrolls all the way down* ... for 2 days of the week - check!
- Entry level font-end position - must be an expert in Vue, Angular, React, AWS, Drupal, Wordpress, PHP, Python, ES9+, OOP, TDD, BDD - check!
- "Cool" description written in js code with no indentation - check!
And I'm not seeing these every once in a while or something like that. No. Most of the posts are like this. I thought I may just be underqualified since I've never had a real job before, but this just seems crazy to me...4 -
Franz is his name, he is our new programmer. He got task to made a calendar to display ongoing ads with javascript, and damn good he done it fast. Until today, he not coming because he got ill and i have to edit his calendar code because there's a change request.I look at his code and thinking how he read this code? no indentation, bracket everywhere, etc. Then I call him:
Me: Franz, can you explain your code to me?
Franz: Sure, but.. umm.. I forgot to bookmark the stackoverflow link.
Me: ...5 -
This is something I'll never forget.
I'm a senior UI engineer. I was working at a digital agency at the time and got tasked with refactoring and improving an existing interface from a well known delivery company.
I open the code and what do I find? Indentation. But not in the normal sense. The indentation only went forward, randomly returning a bunch of tabs back in the middle of the file a few times, but never returning to its initial level after closing a tag or function, both on HTML and JS.
Let that sink in for a minute and try to imagine what it does to your editor with word wrapping (1 letter columns), and without (absurd horizontal scrolling).
Using Sublime at the time, ctrl+shift+P, reindent. Everything magically falls beautifully into place. Refactor the application, clean up the code, document it, package it and send it back (zip files as they didn't want to provide version control access, yay).
The next day, we get a very angry call from the client saying that their team is completely lost. I prove to the project manager that my code is up to scratch, running fine, no errors, tested, good performance. He returns to the client and proves that it's all correct (good PM with decent tech knowledge).
The client responds with "Yeah, the code is running, but our team uses tabs for version control and now we lost all versioning!".
Bear in mind this was in 2012, git was around for 7 years then, and SVN and Mercury much longer.
I then finally understood the randomness of the tabs. The code would go a bunch of tabs back when it went back to a previous version, everything above were additions or modifications that joined seamlessly with the previous version before, with no way to know when and so on.
I immediately told the PM that was absurd, he agreed, and told the client we wouldn't be reindenting everything back for them according to the original file.
All in all, it wasn't a bad experience due to a competent PM, but it left a bad taste in my mouth to know companies have teams that are that incompetent, and that no one thought to stop and say "hey, this may cause issues down the line".4 -
I’ve been programming with other languages than Python for so long that when I finally had to pick up Python to help teach my friend some python I felt like I was rediscovering a past life.
With Python I feel like King Fucking Arthur with the Holy Blade Excalibur, armored up and ready for fucking war.
When I’m writing a script I feel like I’m parrying and piercing my blade straight through that fuckers chest and slam them into the fucking ground. And leave their bleeding out cold dying body on the fucking ground with no hope in their eyes.
Although when an indentation error occurs I feel like I just fucking tripped over a fucking pebble and apparently stairs were nearby and I bash my head on all 1024 steps, get to the bottom to just to get some fucking Java Chad punt my fucking head like a fucking football screaming random reasons to not use python.7 -
I've been lurking on devrant a while now, I figure it's time to add my first rant.
Little background and setting a frame of reference for the rant: I'm currently a software engineer in the bioinformatics field. I have a computer science background whereas a vast majority of those around me, especially other devs, are people with little to no formal computer background - mostly biology in some form or another. Now, this said, a lot of the other devs are excellent developers, but some are as bad as you could imagine.
I started at a new company in April. About a month after joining a dev who worked there left, and I inherited the pipeline he maintained. Primarily 3 perl scripts (yes, perl, welcome to bioinformatics, especially when it comes to legacy code like is seen in this pipeline) that mostly copied and generated some files and reports in different places. No biggie, until I really dove in.
This dev, which I barely feel he deserves to be called, is a biology major turned computer developer. He was hired at this company and learned to program on the job. That being said, I give him a bit of a pass as I'm sure he did not have had an adequate support structure to teach him any better, but still, some of this is BS.
One final note: not all of the code, especially a lot of the stupid logic, in this pipeline was developed by this other dev. A lot of it he adopted himself. However, he did nothing about it either, so I put fault on him.
Now, let's start.
1. perl - yay bioinformatics
2. Redundant code. Like, you literally copied 200+ lines of code into a function to change 3 lines in that code for a different condition, and added if(condition) {function();} else {existing code;}?? Seriously??
3. Whitesmiths indentation style.. why? Just, why? Fuck off with that. Where did you learn that and why do you insist on using it??
4. Mixing of whitesmiths and more common K&R indentation.
5. Fucked indentation. Code either not indented and even some code indented THE WRONG WAY
6. 10+ indentation levels. This, not "terrible" normally, but imagine this with the last 3 points. Cannot follow the code at freaking all.
7. Stupid logic. Like, for example, check if a string has a comma in it. If it does, split the string on the comma and push everything to an array. If not, just push the string to the array.... You, you know you can just split the string on the comma and push it, right?? If there is no comma it will be an array containing the original string.. Why the fuck did you think you needed to add a condition for that??
8. Functions that are called to set values in global variables, arrays, and hashes.. function has like 5 lines in it and is called in 2 locations. Just keep that code in place!
9. 50+ global variables/hashes/arrays in one of the scripts with no clear way to tell how/when values are set nor what they are used for.
10. Non-descriptive names for everything
11. Next to no comments in the code. What comments there are are barely useful.
12. No documentation
There's more, but this is all I can think to identify right now. All together these issues have made this pipeline the pinnacle of all the garbage that I've had to work on.
Attaching some screenshots of just a tiny fraction of the code to show some of the crap I'm talking about.6 -
We don't need no vim
We don't need no C++
We don't need no Internet
We don't need no devRant
We don't need Java
We don't need Windoze
We don't need spaces for indentation
We don't need School
*passive aggressive smiley*8 -
Oh man. I have been waiting for this one. Gather round lil' chil'rens it's story time.
So. I was looking for a new project because my old one was wrapping up and that's what my company does. So I was offered some simulation type stuff. I was like "sure why not, I want to make a computer pretend it isn't a computer no more." Side note I should not be a psychiatrist.
So, prior to coming on to this job I felt stifled by my old job's process. This job was a smaller team so I thought the process would be a little smoother. But it turned out they had NO process. Like they had a bug tracking system and they held the meeting to add things to the system, but that was just fucking lip service to a process.
First of all, they used the local disk on the test box as their version control. and had no real scheme as to how they organized it. We had a CM tool but gods forbid they ever fucking use it. I would be handed problem reports and interface change requests, write a bug to track it, go into the code and about 75% of the time or more it had already been worked. However, there was no record of it being worked and I would have to fucking hunt that shit down in a terribly shitty baseline (standardize your gods damned indentation for fuck's sake) and half the time only found out it was done because when I finally located the piece of code that needed changing, the work was already done.
Then, on top of all that, they ask me what time I want to come in. I said 10am, they said okay. One day I roll in at 10 and my boss is mad. Because I missed a meeting. That was at 9. That I wasn't told about. He says I can keep coming in at 10am though (I asked and volunteered to help get him up to speed on the things I was working he said it wasn't necessary) so I did, but every time I missed a 9am meeting he would get pissed. I'm like PICK ONE!!! They move the meeting to 9:30am (which is not 10am).
This shit starts affecting my health negatively. Stress is apt to do that. It triggered an anxiety relapse that pushed me back in to therapy for the first time in 7 years. On top of that the air quality in the office is so bad that I am getting back to back sinus infections and I get put on heavy antibiotics that tear up my stomach along with the stress and new meds tearing up my stomach. So one day as I am laid out in pain, I call out sick. Two days in a row. (Such a heinous crime right.) Well I missed a test event, that I wasn't even the primary or secondary on.
So fast forward to the most pissed off I have ever been. I get called in to a meeting with my boss's boss. As it turns out, my coworkers are not satisfied by the work that I'm doing (funny because I thought I was doing pretty good given that my only direction was fix the interface change reports and problem reports. And there was no priority assigned to any of them).
And rather than tell me any of this, they go behind my back to the boss and boss's boss. They tell me I need to communicate (which I did) and ask for help when I need it (I never did). That I missed an important event (that I played no part in and gods forbid I be sick) and that it seemed like I didn't want to be there (I didn't but who WANTS to work a corporate job).
They put me on a performance improvement plan and I jumped to another project. I am much happier now. Old coworkers won't even say hi, not even those I was friendly with, but fuck them anyway.5 -
> raw http request injected in the model
> 400 lines long method, followed by three 300 lines long methods
> no autocomplete, no comments
> code called by the whole application, I mess up once there's at least 150 other components that might break
> no documentation, no tests
> pyramid of doom, 13 levels of indentation
Those are the same people getting all puffed up because the cat dared to sit on my shoulder during a call. Management focused on the real fucking problems, no doubt.rant 1 your mother gorges herself 2 with the most vilesome dicks in the kingdom 3 in rows of 250 each4 -
So I've taken over a project, well, not really taken over, we've been hired to add more functionality to a Wordpress site.
I have never seen such a messy code in my life... variables have mixed languages, indentation is a mix of tabs, 2, 3 and 4 spaces, camelcase, snake case, short names, long names. ' and ", no spaces after commas (gotta save those bytes doode)
Almost like it has been copypasted from everywhere.
I think I said 10-15 hours for it. I think I will spend a lot more time tidying up this code.
Hey, look, 3 index files!!
index.php
index__backup.php
index__backup_2.php
I don't dare to look into the CSS or JS, but I know I have to3 -
When in internship you have to read 150000 lines of code to make changes and the code does not have any comments, no indentation, no documentation, no wiki. You'll be like fuck this shit. I'm outta here.1
-
rant & question
Last year I had to collaborate to a project written by an old man; let's call him Bob. Bob started working in the punch cards era, he worked as a sysadmin for ages and now he is being "recycled" as a web developer. He will retire in 2 years.
The boss (that is not a programmer) loves Bob and trusts him on everything he says.
Here my problems with Bob and his code:
- he refuses learning git (or any other kind of version control system);
- he knows only procedural PHP (not OO);
- he mixes the presentation layer with business logic;
- he writes layout using tables;
- he uses deprecated HTML tags;
- he uses a random indentation;
- most of the code is vulnerable to SQL injection;
- and, of course, there are no tests.
- Ah, yes, he develops directly on the server, through a SSH connection, using vi without syntax highlighting.
In the beginning I tried to be nice, pointing out just the vulnerabilities and insisting on using git, but he ignored all my suggestions.
So, since I would have managed the production server, I decided to cheat: I completely rewrote the whole application, keeping the same UI, and I said the boss that I created a little fork in order to adapt the code to our infrastructure. He doesn't imagine that the 95% of the code is completely different from the original.
Now it's time to do some changes and another colleague is helping. She noticed what I did and said that I've been disrespectful in throwing away the old man clusterfuck, because in any case the code was working. Moreover he will retire in 2 years and I shouldn't force him to learn new things [tbh, he missed at least last 15 years of web development].
What would you have done in my place?10 -
Oh my fucking God, the non dev we have on our team has no indentation or syntax filter whatsoever. I wouldn't be surprised if she has an unmatched or unclosed bracket somewhere. I'm gonna have to go in there and clean that shit up.6
-
A (work-)project i spent a year on will finally be released soon. That's the perfect opportunity to vent out all the rage i built up during dealing with what is the javascript version of a zodiac letter.
Everything went wrong with the beginning. 3 people were assigned to rewrite an old flash-application. Me, A and B. B suggested a javascript framework, even though me and A never worked with more than jquery. In the end we chose react/redux with rest on the server, a classic.
After some time i got the hang of time, around that time B left and a new guy, C, was hired soon after that. He didn't know about react/redux either. The perfect start off to a burning pile of smelly code.
Today this burning pile turned into a wasteland of code quality, a house of cards with a storm approaching, a rocket with leaks ready to launch, you get the idea.
We got 2 dozen files with 200-500 loc, each in the same directory and each with the same 2 word prefix which makes finding the right one a nightmare on its on. We have an i18n-library used only for ~10 textfields, copy-pasted code you never know if it's used or not, fetch-calls with no error-handling, and many other code smells that turn this fire into a garbage fire. An eternal fire. 3 months ago i reduced the linter-warnings on this project to 1, now i can't keep count anymore.
We use the reactabular-module which gives us headaches because IT DOESN'T DO WHAT IT'S SUPPOSED TO DO AND WE CANT USE IT WELL EITHER. All because the client cant be bothered to have the table header scroll along with the body. We have methods which do two things because passing another callback somehow crashed in the browser. And the only thing about indentation is that it exists. Copy pasting from websites, other files and indentation wars give the files the unique look that make you wonder if some of the devs hides his whitespace code in the files.
All of this is the result of missing time, results over quality and the worst approach of all, used by A: if A wants an ui-component similar to an existing one, he copies the original and edits he copy until it does what he wants. A knows about classes, modules, components, etc. Still, he can't bring himself to spend his time on creating superclasses... his approach gives results much faster
Things got worse when A tried redux, luckily A prefers the components local state. WHICH IS ANOTHER PROBLEM. He doesn't understand redux and loads all of the data directly from the server and puts it into the local state. The point of redux is that you don't have to do this. But there are only 1 or 2 examples of how this practice hurt us yet, so i'm gonna have to let this slide. IF HE AT LEAST WOULD UPDATE THE DATA PROPERLY. Changes are just sent to the server and then all of the data is re-fetched. I programmed the rest-endpoints to return the updated objects for a very reason. But no, fuck me.
I've heard A decided (A is the teamleader) to use less redux on the next project and use a dedicated rest-endpoints for every little comoutation you COULD DO WITH REDUX INSTEAD. My will is broken and just don't want to work with this anymore.
There are still various subpages that cant f5 because the components cant handle an empty redux state in the beginning, but to be honest i don't care anymore. Lets hope the client will never find out, along with the "on error nothing happens"-bugs. The product should've been shipped last week, but thanks to mandatory bugfixes the release was postponed to next week. Then the next project starts...
Please give me some tips to keep up code quality over time, i cant take this once more.
I'm also aware that i could've done more, talking A and C about code style, prettifying the code, etc. Etc. But i was busy putting out my out fires, i couldn't kill much of the other fires which in the end became a burning building (a perfect metaphor for this software)4 -
Man, people have the weirdest fetishes for using the most unreadable acrobatic shell garbage you have ever seen.
Some StackOverflow answers are hilarious, like the question could be something like "how do I capture regex groups and put them in a variable array?".
The answer would be some multiline command using every goddamn character possible, no indentation, no spaces to make sense of the pieces.
Regex in unix is an unholy mess. You have sed (with its modes), awk, grep (and grep -P), egrep.
I'll take js regex anytime of the day.
And everytime you need to do one simple single goddamn thing, each time it's a different broken ass syntax.
The resulting command that you end up picking is something that you'll probably forget in the next hour.
I like a good challenge, but readability is important too.
Or maybe I have very rudimentary shell skills.5 -
It’s been so long since I posted but this time it’s juicy again.
I got a coworker, no prio experience but already a year and few months into the job. He’s bad.
Magnitudes of bad!
We’re trying to teach him but to no avail. Everything about him sucks, major ballsack to be exact.
His attitude is to avoid every task, finishes nothing and then starts something new.
„Did you do X like we told you to?“
„No I started on Y, because I thought it [looks better, seems more interesting, thought that X is useless…]“
When you ask him much is done he is always „almost“ finished and needs your help on the „last 5-10%“. Yeah fuck that!
But that guy has a talent, his talent is to always give you technically correct answers which actually are complete bullshit.
„What are you doing at your job?“
„Staring at a screen and typing things.“ dude what?
That guy used the excuse „I can’t do maths“ on everything.
For an exam he had to calculate how long it would take to reach a certain amount if you would get some interest in that every year.
He asked the teacher for the formula. During the exam! And when the teacher didn’t want to give it to him he wrote plainly „can’t do maths“ on the paper and left
His code is of a quality as if he would write his first line in a week and then has the audacity to blame me and the colleagues for not explaining it right.
Ok you might think now we’re teaching him bad, or are too impatient. But honestly if you have to explain how to do a for loop for over about 15 months and get that attitude I think you get the right to be angry. I don’t mind explaining on how things work, even for the hundredth time, but then don’t tell me you understood, go behind my back, complain at a colleague how bad I explained, get explained by him and then do it again until you whored yourself through the whole staff!
It’s like he got the mind swiper from Men in black at home. Every day he hits the reset button.
He had a week of just changing indentation on a html file. Why? Because he wanted to find his style.
Yeah his style
if(a==b){
console.log(a);
}
else {
console.log(b)
}
And to produce code like that it takes him atleast 4 hours of trial and error.
And at the same time he goes arround and boasts what a super good programmer he his and that he can do some project work for them.
How we found out? Because he started working in those projects during work time at the office and asked us how to do things.
And he does so like a complete bastard!
Broken sql query? “No that query is perfect as it is, it’s supposed to show no results! But, just in theory, if I wanted to show some results, what would I need to change?”
I’m so mad about it and pissed on a personal level because he goes around blames everyone and the world for his short comings5 -
Things I hate the most at the moment:
- PHP
- jQuery
- The person that coded this before me
- The fact that this person is swtiching from jQuery and native javascript over and over for no f*cking reason. Just why?
- My job
- My boss
- The big pile of sh*it that this code is (overall not just the screenshot), no separation of concern, logic code in the middle of the file, no proper slacing and indentation
- devRant no allowing me to put multiple images in one post, because the picture is just one of this whole mess, it's not even the worst part, you'd have nightmare if I showed it to you
- The mental breakdown I'm having14 -
I just dealt with a 3 nested "if" statements in SQL. There is no indentation so I am quite frustrated since each "if" spans up to 2-30 lines.
I now understand why Python white space is significant3 -
! Worst thing another dev did in our NodeJS code.
1. No indentation. Literally.
2. A single function in a module worth 1000 lines. I'm not even kidding. No breaking into smaller functions. Just a large rock with a lot of js mess scribbled.
3. No comments at all
4. Sending stray values to promises which were not required at all.
5. No jsdoc. Using camelCase and uppercase interchangeably.2 -
I once had to review and transform the code of one of my colleague at school which had no indentation, no spacing and was a clusterf*** of syntax errors. The nightmare was that it was all done in the ancient Turbo C++. So I opened up plain ol' Notepad and whipped up some decent code and helped him out of a tight situation.
Now he is no longer a programmer. :|7 -
Unpopular opinion.
TOML sucks
* it does not claim to care about indentation but it actually does
* nested datastructures are a nightmare, especially 'inline' for 'readability'
* oh fuck me everything must be "double quotes"
* booleans always lowercase, there is no "truthy" here.
* Tables are not intuitive at all.
And all this from working with it first time because I had the silly idea to modernize a python project to use pyproject.toml
Oh and don't get me started on pyproject.toml files. The documentation sucks!6 -
I'm considering quitting a job I started a few weeks ago. I'll probably try to find other work first I suppose.
I'm UK based and this is the 6th programming/DevOps role I've had and I've never seen a team that is so utterly opposed to change. This is the largest company I've worked for in a full time capacity so someone please tell me if I'm going to see the same things at other companies of similar sizes (1000 employees). Or even tell me if I'm just being too opinionated and that I simply have different priorities than others I'm working with. The only upside so far is that at least 90% of the people I've been speaking to are very friendly and aren't outwardly toxic.
My first week, I explained during the daily stand up how I had been updating the readmes of a couple of code bases as I set them up locally, updated docker files to fix a few issues, made missing env files, and I didn't mention that I had also started a soon to be very long list of major problems in the code bases. 30 minutes later I get a call from the team lead saying he'd had complaints from another dev about the changes I'd spoke about making to their work. I was told to stash my changes for a few weeks at least and not to bother committing them.
Since then I've found out that even if I had wanted to, I wouldn't have been allowed to merge in my changes. Sprints are 2 weeks long, and are planned several sprints ahead. Trying to get any tickets planned in so far has been a brick wall, and it's clear management only cares about features.
Weirdly enough but not unsurprisingly I've heard loads of complaints about the slow turn around of the dev team to get out anything, be it bug fixes or features. It's weird because when I pointed out that there's currently no centralised logging or an error management platform like bugsnag, there was zero interest. I wrote a 4 page report on the benefits and how it would help the dev team to get away from fire fighting and these hidden issues they keep running into. But I was told that it would have to be planned for next year's work, as this year everything is already planned and there's no space in the budget for the roughly $20 a month a standard bugsnag plan would take.
The reason I even had time to write up such a report is because I get given work that takes 30 minutes and I'm seemingly expected to take several days to do it. I tried asking for more work at the start but I could tell the lead was busy and was frankly just annoyed that he was having to find me work within the narrow confines of what's planned for the sprint.
So I tried to keep busy with a load of code reviews and writing reports on road mapping out how we could improve various things. It's still not much to do though. And hey when I brought up actually implementing psr12 coding standards, there currently aren't any standards and the code bases even use a mix of spaces and tab indentation in the same file, I seemingly got a positive impression at the only senior developer meeting I've been to so far. However when I wrote up a confluence doc on setting up psr12 code sniffing in the various IDEs everyone uses, and mentioned it in a daily stand up, I once again got kickback and a talking to.
It's pretty clear that they'd like me to sit down, do my assigned work, and otherwise try to look busy. While continuing with their terrible practices.
After today I think I'll have to stop trying to do code reviews too as it's clear they don't actually want code to be reviewed. A junior dev who only started writing code last year had written probably the single worst pull request I've ever seen. However it's still a perfectly reasonable thing, they're junior and that's what code reviews are for. So I went through file by file and gently suggested a cleaner or safer way to achieve things, or in a couple of the worst cases I suggested that they bring up a refactor ticket to be made as the code base was trapping them in shocking practices. I'm talking html in strings being concatenated in a class. Database migrations that use hard coded IDs from production data. Database queries that again quote arbitrary production IDs. A mix of tabs and spaces in the same file. Indentation being way off. Etc, the list goes on.
Well of course I get massive kickback from that too, not just from the team lead who they complained to but the junior was incredibly rude and basically told me to shut up because this was how it was done in this code base. For the last 2 days it's been a bit of a back and forth of me at least trying to get the guy to fix the formatting issues, and my lead has messaged me multiple times asking if it can go through code review to QA yet. I don't know why they even bother with code reviews at this point.18 -
Mind blow of the week: JavaScript has no "else if".
It's always two tokens. Not one. It's NOT like python's "elif".
It's ALWAYS chaining an additional and DISTINCT if statement in the else clause of the first. It is NOT creating multiple comparison paths in the same if statement as it would seem.
For example:
if(a) console.log(a);
else if(b) console.log(b);
else console.log(c);
Simply needs more proper indentation to show which "if" the "else" actually belongs to:
if(a) console.log(a);
else
if(b) console.log(b);
else console.log (c);9 -
So, this is my first actual rant since I joined devRant and I am not saying I am perfect either. Here goes nothing...
1. I honestly hate it when people use spacebar instead of tabs
2. People who have a bad indentation or no indentation at all (even though almost all IDEs have auto-indentation). The bad thing is when a person asks me to have a look at their code I always end up wasting time fixing the indentation rather the actual problem.
I love a properly indented code and that's one of the major reason I usually recommend Python to most people.
3. Lastly, people who leave lots of unnecessary empty lines. E.g.,
public class HelloWorld{
public static void main(String[]args){
System.out.println("Hello world!");
}
}13 -
Background:
I graduated high school from a technical school. And my teacher asked me to come in a few times a week and assist (which I LOVE doing)
So they’re working with circuits and raspberry pi’s and when I can in they pointed out that there was a project they couldn’t get to work. So I had to look at it. Now I was not given the original it was one a student tried to copy in (like they were supposed to) but it was awful. All the indentation was even more off than the original and on top of that. The original and what I was given wouldn’t give an error code.. and so I had no idea what was happening so I just decided to try to fix the indentation and take out stuff that didn’t look right (what else was I supposed to do when I didn’t know where to start?) and while I was doing it another student started to try to fix it and it legit barely took 5 minutes and now my spirit and confidence is broken. I wasn’t petty I observed the result and congratulated him cause he deserved it. After I took the code and put it on my laptop and figured out it was an “inconsistent use of tabs and spaces” error which is fucking stupid and I’ve never seen that in python before so after I debugged that there wasn’t really anything left to debug. So I guess I somewhat redeemed myself but I still feel like shit2 -
what the hell this friendo just sent me a 100 line Julia function with variables names like `sauce` and `thingy` and expected me to debug it. And I guess his tab key was broken cause there was no indentation at all. Did I mention I’ve never used Julia in my life? Is this just Julia culture?7
-
Once I maintained one of the most used and fucked up codebases on the market with almost 1M+ daily users. (cannot say more, sorry).
It's written in PHP and is absolutely terrifying,
the first time I saw some lines of code I was about to scream and cry.
- spaghetti code
- no indentation
- random SQL query unoptimized
- unused vars
- Code is split among several files with no logical reasoning
- Mixed procedural and oop programming
- Unsanitised user input (yes, you got it right)
No test environment, no backup database, every commit goes straight to production.
It's a real disaster but the company prefers to keep it as it is without refactoring or anything else.
Just to make it clear:
It's not hatred against PHP, it's against the code's current status and the older programmers which used to work on it.5 -
Where do I even start???? Python is killing me. I am a beginner when it comes to coding but somehow the indentation in Python gets me every time. No matter how many times I follow a tutorial I always end up with at least one indentation error. How do people do this?!?28
-
Best
typescript - I needed to learn it for a project and I like it, I know java and javascript and it is something in between of those two that makes writing enterprise web applications easier, it’s nice that you can debug it directly in chrome, it makes things easier
Worst
docker, Dockerfiles - devops tools - amount of shell commands inside them and mangled && to make everything running in one file layer makes those unreadable mess that you need to think twice to understand, there is no debugger for it, you do everything with try and see what happens, there is actually no real dev toolset for devops and that sucks, since you got builder images that makes things more mangled than before, it’s clearly missing some external officially approved scripting language or at least
FUNCTION and
WITH LAYER and indentation / parentheses syntax and they still trying to make it flat, why are you doing that ?
as a result next to Dockerfile cause you can’t import multiple ones you get bunch bash scripts with mangled syntax and other crap that is glued together to make a monster - and this runs most of current software on this planet2 -
There a times I love python for its quick way of writing things. But there are more times that python makes me angry or just frustrates me with its indentation logic.🤪
When the indentation in my project lets the code either accidentally run a million times more or a tab/spaces inconsistency that no tool warns me about except runtime error.
What about a language that combines pythons easy way with brackets on top?😪 I guess it already exists?😅
For my project C++ would be a viable alternative, but so far the language seems very weird to write.12 -
I used to fucking love VSCode it visually was great, it was simple, had an integrated terminal that wasn't shit, supported many languages well (while not forcing every extension down your throat), and was straightforward to configure. I also had problems with it, mainly I felt it was way too bloated for an editor.
That good impression I had is gone now. It seems like every time I'm actually using the editor I have to fight with it. Whether that's an update that fucked up my config, or a reinstall and now I have to **convince** my fucking editor to use tabs instead of spaces automatically and I have to specify because holy shit it will not just listen after I set every possible fucking indentation setting to disable spaces or enable/prefer tabs and they keep adding shit like this that I give no shits about that make me sift through the damn settings finding the settings that turn off whatever new visual effect or quirky little automation they've implemented. I can't tell you how much I actively don't want my braces to be matched up by a color that doesn't even have anything to do with my color scheme.
Ive tried switching but holy shit intellisense is such a great feature that helps me so much so I'm not always bouncing between docs and my editor. Which ATM I'm learning go and intellisense has more fucking information on the functions than the docs do. I've seen Neovim (which is what I'm probably switching to) has language servers that are similar to intellisense so I'm intrigued to try that.
I'm just tired of constantly having to avoid all this shit I don't give a fuck about. I just want to get in, do my thing.
I won't be surprised if I'm the only one on this train 🤣8 -
This code base can't upgrade to 5.4 because it depends on register_globals. The files affected has no indentation for else blocks. Randomly indented with space and tab. On top of it all, one of the previous devs were dyslexic. Save me.
-
Junior Dev about 18months in my current job and I've got a problem
Started to feel not wanting to code at work, despite working on a greenfield project thats critical and using new tech. I get a little defensive about PR's over stupid small things (PR was once rejected due to auto indentation "not to standard").
Talked with boss (who I get on well with and like) and thinks my problem is I've lost confidence coding. Trys to get more senior Dev to on side to help me out more.
Same senior Dev is really close with other junior on my team - pair on alot of stuff all the time, have lunch and spend free time together, and will work way past working hours just to try and finish something that day (even though it's not due that day).
(Probs working ~60h weeks, where as I'm ~42h and contracted for 37h. I'll work on if I need to but tries to have balance)
Senior and other junior tend to ignore tickets on the board, do the work and then when I pick it up they say "I did that last night". No docs, no PR for me to ask about how it was done (as they merged it themselves). (They have previously completely refactored my branch in the past overnight then not told me atall)
I'm not saying its favouritism here, but I'm not happy with the situation. I feel I can't ask questions as they are always together or they discuss the problem themselves and just give me the answer (not really acknowledging my points). I dont tend to ask for help from this senior Dev now as I don't feel it's worthwhile learning wise for me.
Other people in the team are great but working on other aspects so not a direct one-to-one alignment (others are DB Dev & principal senior dev)
Furthermore I'm wanting to possibly work on full stack web or more architecture stuff, both which are not in my current teams remit (backend up to API).
So - what do I do? Try and remedy the situation in the current team as best as or look for a new teams as cut my losses.
I'm torn between the 2 and I'm unsure how to get out this rut. I feel I need to find a solution to this soon though
(Sorry for the long rant folks)4 -
Was given some changes a client wanted done on a site that a couple of my predecessors worked on. They were pretty basic so thought, no prob, let's get this done and move on the more important things. Open the 3000 line css file..... no indentation..., syntax errors and warning all over the place and of course no documentation. A convoluted mess. Fixing the errors would basically break the site due to all the unnecessary overwrites. Literally the worst style sheet I've ever seen.1
-
don't you just love it when you have to fix a system that consists on unnecessary junk code, horrible/lack of indentation, no documentation and the clients says "I don't know what happened fix it and I'll post you good"
I mean, I live for this shit man! -
I know there is this huge argument about whether to use tabs or 4 spaces and while I'm on neither side, just sitting there using tabs, in this new project I'm FORCED to use a 1 space indentation and no line breaks in Android layout XML files format.
I sat there for about 10 minutes trying to wrap my head around d this absurd specification they agreed upon with the client. The code looks SHIT and every time I copy some beautifully formatted reference code into this project it turns into a piece of unreadable garbage.
But since I'm just a part-timer and the senior developer working on this project for some years now is much more experienced than me, I'm hesitant to criticise it more than I already did.
Maybe I'll start arguing with industry standards and the improvement for new developer to read our code... -
So here is a mini rant from an amateur/hobbyist developer (me).
Over the past week, I've taken on a project that is much larger than any other projects i've attempted to handle (steam trading bot). This meant that there would be logic flaws, weird bugs due to unexpected behavior from shitty web apis (and their poor documentation hmmmm).
Anyhow, fast forward a few days and the code is complete. It's mostly functional, apart from a few glitches and unexpected behavior here and there...or so i thought. Apparently if someone trades and item to me that isnt in my pricegrid, the bot freaks out and kills itself, relaunches, and repeats this cycle (pm2). And i only found out about this on my way to school
So in desperation to fix such a critical flaw in my code (if my bot breaks a lot and doesnt accept trades, i can get banned from backpack.tf), i bust out my only device which is my phone, and start editing away (JuiceSSH and turbo client is godsend ty). 30 minutes later, after toiling through code with no indentation or syntax highlights (mobile pls), ive fixed it. So i push to live and alls well.
Then I arrive at school, pull out my laptop and decided to check up on my code to see if anything needs fixing.
Oh look in one line i used '||' instead of '&&'.
ok lets fix it.
ok lets push to live again.
I launched WinSCP to move the files onto the server, and just as the loading bar finishes and the file is overwritten, i realized; FUCK the code i had on my laptop wasnt the latest version i just worked on on my phone.
So that's that. 30 minutes of typing code without indentation and syntax highlighting on a 5 inch screen and it's all gone.
TLDR:
Version control is a must. -
My coding style is mostly influenced by good old personal preference, but also because of a certain internship where there was a lot of gain to be had by making everything as reusable and testable as possible.
I guess you could say my motto is usability, readability and flexibility:
I like tidy, reusable code with an emphasis on keeping code readable. I've always liked modular things I guess...
And I despise two things: curly brackets on the next line and spaces for indentation... But way worse is having no brackets at all (looking at you Python): it's clearer to have lower-level code inside some sort of "container" markers i.e. brackets (also gives more IDE functionality like color-coding hierarchically).
Indentation should always be tabs so anyone can have their own width of indentation set through their IDE, making it way more accessible to fellow colleagues!
And I also like having parameterized code over hard-coded functions: way more flexible.