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 - "todo comments"
-
Seen at work in code:
<!-- DO NOT REMOVE CONTENTS PLACED HERE //TODO: Would have loved if some one also had said why we should not remove this -->
Lol1 -
I hate myself. Really.
Last week I wrote a function to handle file uploads and at some point I left this very useful comment.
Do I know what to fix? Absolutely fucking nope.
I want to punch me from last week in the face9 -
-- Once upon a time in a long forgotten country, a most wise wizard created a magic software that would replace all TODO comments in PHP files with actual code...
-- But dad, that's the wrong story. You wanted to tell the story of the WTF witch who makes all JS objects falsy.
Me -- Hm, okay mister, you got me. Let's see.
Me again -- Once upon a time in the far-off country of Whatthefuckia...
Man I'm so proud of my son.1 -
gotta love them comments:
#TODO: move this,
#TODO: deprecated,
#TODO: fix this,
#TODO: DON'T DO THIS,
#TODO: refactor,
#TODO: CHANGE THIS
I shit you not6 -
I don't know if I'm being pranked or not, but I work with my boss and he has the strangest way of doing things.
- Only use PHP
- Keep error_reporting off (for development), Site cannot function if they are on.
- 20,000 lines of functions in a single file, 50% of which was unused, mostly repeated code that could have been reduced massively.
- Zero Code Comments
- Inconsistent variable names, function names, file names -- I was literally project searching for months to find things.
- There is nothing close to a normalized SQL Database, column ID names can't even stay consistent.
- Every query is done with a mysqli wrapper to use legacy mysql functions.
- Most used function is to escape stirngs
- Type-hinting is too strict for the code.
- Most files packed with Inline CSS, JavaScript and PHP - we don't want to use an external file otherwise we'd have to open two of them.
- Do not use a package manger composer because he doesn't have it installed.. Though I told him it's easy on any platform and I'll explain it.
- He downloads a few composer packages he likes and drag/drop them into random folder.
- Uses $_GET to set values and pass them around like a message contianer.
- One file is 6000 lines which is a giant if statement with somewhere close to 7 levels deep of recursion.
- Never removes his old code that bloats things.
- Has functions from a decade ago he would like to save to use some day. Just regular, plain old, PHP functions.
- Always wants to build things from scratch, and re-using a lot of his code that is honestly a weird way of doing almost everything.
- Using CodeIntel, Mess Detectors, Error Detectors is not good or useful.
- Would not deploy to production through any tool I setup, though I was told to. Instead he wrote bash scripts that still make me nervous.
- Often tells me to make something modern/great (reinventing a wheel) and then ends up saying, "I think I'd do it this way... Referes to his code 5 years ago".
- Using isset() breaks things.
- Tens of thousands of undefined variables exist because arrays are creates like $this[][][] = 5;
- Understanding the naming of functions required me to write several documents.
- I had to use #region tags to find places in the code quicker since a router was about 2000 lines of if else statements.
- I used Todo Bookmark extensions in VSCode to mark and flag everything that's a bug.
- Gets upset if I add anything to .gitignore; I tried to tell him it ignores files we don't want, he is though it deleted them for a while.
- He would rather explain every line of code in a mammoth project that follows no human known patterns, includes files that overwrite global scope variables and wants has me do the documentation.
- Open to ideas but when I bring them up such as - This is what most standards suggest, here's a literal example of exactly what you want but easier - He will passively decide against it and end up working on tedious things not very necessary for project release dates.
- On another project I try to write code but he wants to go over every single nook and cranny and stay on the phone the entire day as I watch his screen and Im trying to code.
I would like us all to do well but I do not consider him a programmer but a script-whippersnapper. I find myself trying to to debate the most basic of things (you shouldnt 777 every file), and I need all kinds of evidence before he will do something about it. We need "security" and all kinds of buzz words but I'm scared to death of this code. After several months its a nice place to work but I am convinced I'm being pranked or my boss has very little idea what he's doing. I've worked in a lot of disasters but nothing like this.
We are building an API, I could use something open source to help with anything from validations, routing, ACL but he ends up reinventing the wheel. I have never worked so slow, hindered and baffled at how I am supposed to build anything - nothing is stable, tested, and rarely logical. I suggested many things but he would rather have small talk and reason his way into using things he made.
I could fhave this project 50% done i a Node API i two weeks, pretty fast in a PHP or Python one, but we for reasons I have no idea would rather go slow and literally "build a framework". Two knuckleheads are going to build a PHP REST framework and compete with tested, tried and true open source tools by tens of millions?
I just wanted to rant because this drives me crazy. I have so much stress my neck and shoulder seems like a nerve is pinched. I don't understand what any of this means. I've never met someone who was wrong about so many things but believed they were right. I just don't know what to say so often on call I just say, 'uhh..'. It's like nothing anyone or any authority says matters, I don't know why he asks anything he's going to do things one way, a hard way, only that he can decipher. He's an owner, he's not worried about job security.13 -
When you find a 'TODO' comment deep in a crucial function, that you know have been there for at least 5 years. :S
-
The best/worst code comments you have ever seen?
Mine:
//Upload didn't work, have to react:
system.println('no result');
//$Message gives out a message in the compiler log.
{$Message Hint 'Feed the cat'}
//Not really needed
//Closed source - Why even comments?
//Looks like bullshit, but it has to be done this way.
//This one's really fucked up.
//If it crashes, click again.
asm JMP START end; //because no goto XP
catch {
//shit happens
}
//OMG!!! And this works???
asm
...
mov [0], 0 //uh, maybe there is a better way of throw an exception
...
mov [0], 0 //still a strange way to notify of an error
// this makes it exiting -- in other words: unstable !!!!!
//Paranoic - can't happen, but I trust no one.
else {
//please no -.-
sleep(0);
}
//wuppdi
for (int i = random(500); i < 1000 + random(500 + random(250)); i++)
{
// Do crap, so its harder to decompile
}
//This job would be great if it wasn't for the f**king customers.
//TODO: place this peace of code somewhere else...
// Beware of bugs in the code above; I have only proved it correct, not tried it.
{$IFDEF VER93}
//Good luck
{$DEFINE VER9x}
{$ENDIF}
//THIS SHIT IS LEAKING! SOMEONE FIX IT! :)
/* no comment */5 -
// TODO : Resurrect dev team
if(devRant.development ⩶ 'active')
devRant.notifications.addPanel({
content : [ '++' , 'comments' ] ,
type : 'split'
})6 -
I have the habit of adding //todo comments to my code whenever I need to implement something later. Very useful to just search your code for "todo" and see what is left to do.
That is all very well, but I just searched my project for "todo" and there are SO MANY //todo comments in the third party dependencies...4 -
I am glad that I usually include comments, which make me smile years later...
What are your best findings when you look at your old code?
something like:
// having any and all at the same hierarchy is not valid (and stupid)
someMistakeDeep: 1 // deep fail
// TODO: find out, why the cache is behaving like this. And fix it ¯\_(ツ)_/¯
or my all time favorite comments
// this should not happen.
// wat?
or testing emails like
- tldsAreNotCheckedBTW@something.idontthinkthisdoesexist
- nonValidEmail.com
or urls...
- ProtocolMissing.com
- www.stillNoProtocol.com
And when I'm out of ideas, something like this
messageContent: 'Bla Bla Bla. Exception in FS on Host https://w.com/hpsa',
{ SmsVerb: 'randomVerb' }, // unknown Attribute5 -
Had my dev job described as a "computer, desk job" in a condescending tone yesterday by a guy trying to convince me to join his pyramid scheme....
// TODO: come up with awesome rant about this so I can look badassundefined todo come up with better tags todo documentation comments shit okay not sure how to tag this shit2 -
Those devs that put TODO comments everywhere in code. When has anyone actually ever seen a TODO and DID it? Put the task in jira/trello/whatever and leave the future source of confusion out of the code base!3
-
When comments find their way to class tests:
“TODO: Finish conjugation of montre in the whole text”. I had no idea of the conjugation and finished under time pressure so this stayed in the class test (gave it back last second) and I was well aware of it.
Just wondering what the teacher must have thought. Didn’t say (or write) a word about it tho.
Should see if someone tweeted or posted this (I mean someone wrote a book only with examples of stuff like this)
Idk, I should ask if I’m allowed to write class test in an IDE. And set MARK, TODO, etc. Would make them a lot easier.30 -
Recently took over a freelance project to update an existing app, and this thing is full of comments like "TODO: Remove This" with no context. So hard to work with.
For the love of God, add some context to your comments. Especially if someone else is going to be seeing your code. -
Any good advice for managing junior developers?
In my experience I have found that loose definitions of work to be completed yields poor results. Honestly, sometimes I wonder if I have to write the code structure and leave a bunch of TODO comments for people to fill in.
Or alternatively people get going on tangents without thinking of the concrete problem given.
Or go try building generic abstractions that are unneeded and will not be reused complicating even the simplest use case.
Maybe the problem is in me and that I am not clear in communicating what's needed. What techniques do you guys use to get more or less what you want?7 -
def longVariableNamesEverywhere(*args):
"""
Not a substitute for docstrings and code comments.
"""
#TODO: insert witty and legible code.
#TODO: learn to read code.
return "Rant and self-deprecation complete."4