// TODO

๐ŸŽ™๏ธ taires ยท 17236 points ยท Posted at 11:10:41 on June 27, 2017 ยท (Permalink)


Saved comment

frisch85 ยท 1342 points ยท Posted at 12:33:21 on June 27, 2017 ยท (Permalink)

Just remove the //TODO and leave the rest. I'm sure everything will be all right.

[deleted] ยท 605 points ยท Posted at 13:42:20 on June 27, 2017 ยท (Permalink)

If it doesn't crash, it works.

[deleted] ยท 251 points ยท Posted at 14:35:41 on June 27, 2017 ยท (Permalink)

[deleted]

afito ยท 224 points ยท Posted at 14:40:36 on June 27, 2017 ยท (Permalink)

Schrรถdingers Readability, the more fucked up a piece of code seems the better it works. If it's simple and easily understandable it will probably crash and burn in every single line.

CityYogi ยท 129 points ยท Posted at 15:27:30 on June 27, 2017 ยท (Permalink)

Every block of code that you aren't understanding is a corner case and a prod hot fix. I couldn't document why because it was on a weekend. I'm pretty sure the code makes complete sense though. When I wrote it, you were still wearing diapers, btw.

afito ยท 90 points ยท Posted at 16:06:09 on June 27, 2017 ยท (Permalink)

When I wrote it, you were still wearing diapers, btw.

As long as you are still around idgaf. Worked with some old C / Fortran stuff some years back and there was code signed by let's call him "Ray". "Ray" retired in 1995. But fear not, he had an apprentice, "Jack". Who retired 3 years ago as well.

bhaavan ยท 48 points ยท Posted at 18:20:21 on June 27, 2017 ยท (Permalink)

Jack of all trades, Ray of none.

MonokelPinguin ยท 8 points ยท Posted at 21:56:16 on June 27, 2017 ยท (Permalink)

I just replaced some C code from 1994, but only because the API it depends on is being removed. I'm pretty sure there is other code, that is still running and didn't need to be replaced. Also I don't mind the old code if it still works well. You never need to replace something just because it is old.

CityYogi ยท -16 points ยท Posted at 18:11:44 on June 27, 2017 ยท (Permalink)

Code from 1995 shouldn't be in production in 2017. It belongs to museums and should be there for amusement only. Whole paradigms have shifted 22 years. Get the budgets sorted and reimplement it if possible. I know one shouldn't fix what isn't broken but this is going to far

[deleted] ยท 41 points ยท Posted at 18:44:42 on June 27, 2017 ยท (Permalink)

Code from 1995 shouldn't be in production in 2017... Whole paradigms have shifted 22 years.

These comments make it sound like you haven't graduated college yet.

Worker: "Hey boss, we gotta move to a hot new tool-specific pattern!"

Boss: "Why?"

Worker: "BECAUSE PARADIGMS HAVE SHIFTED!"

endreman0 ยท 1 points ยท Posted at 11:56:14 on June 28, 2017 ยท (Permalink)

Probably isn't even in college yet. You learn thatbif shit works, and I don't need to fix it today, I'm not reinventing it today.

PM_ME_YOUR_LEFT_IRIS ยท 19 points ยท Posted at 18:59:00 on June 27, 2017 ยท (Permalink)

If it's Fortran then that shit is going nowhere and relies on black magic to function.

[deleted] ยท 2 points ยท Posted at 21:52:06 on June 27, 2017 ยท (Permalink)

/u/CityYogi is going to have his mind blown when he learns that there are Fortran routines running in major parts of the scientific research or engineering sector that are older than his parents yet the language itself is still being evolved.

PM_ME_YOUR_LEFT_IRIS ยท 3 points ยท Posted at 22:36:36 on June 27, 2017 ยท (Permalink)

Mhm, we had a few machines that ran it in my old spectroscopy lab. Not even the PI knew what made the damn thing tick, but it did what we needed.

CityYogi ยท 1 points ยท Posted at 02:02:55 on June 28, 2017 ยท (Permalink)

I'm 27 and have done python programming all my life. So you're right about the fact that I had mind blown learning Fortran code is still in use. My bad!

pekkhum ยท 1 points ยท Posted at 04:04:23 on June 30, 2017 ยท (Permalink)

We have 4 guys who know Fortran, but anytime we touch a Fortran program in any major way, it gets an all expenses paid trip to C World.

afito ยท 10 points ยท Posted at 18:23:03 on June 27, 2017 ยท (Permalink)

I mean it's Fortran, so chances are it's either military, aerospace, or both. Things work a bit different and fucked up in these industries, partially because of all the hoops you have to jump through to even be allowed to run a system, and the money involved in the testing and verification of these systems.

Just imagine the things these poor souls have to deal with that sometimes have to bother with the F-16 for example.

PC__LOAD__LETTER ยท 2 points ยท Posted at 23:06:14 on June 27, 2017 ยท (Permalink)

Once worked on code for a very small part of that aircraft. Knowing what goes into it now makes me feel both safer and more at risk while flying.

CityYogi ยท 1 points ยท Posted at 02:04:41 on June 28, 2017 ยท (Permalink)

Yeah it's very reassuring to know that the aircrafts are using technology that most don't understand because it was implemented long time ago.

DipIntoTheBrocean ยท 5 points ยท Posted at 20:32:09 on June 27, 2017 ยท (Permalink)

If it's ain't broke, don't fix it. Unless you can strongly convince someone that the investment you're pouring into that project will pay for itself quickly when it comes to upgrade time, but that's rarely the case.

Think of the manpower involved, time spent not making the company any money, the time to gather requirements, lead the project, QA every change, actually do the deployment, deprecate the old system...and then be on the hook for any gotchas which weren't documented and so which you didn't replicate, if they were even documented in the first place.

It's honestly a monumental task and usually not worth it in the money and sanity sense of the word.

MartinCorwin ยท 7 points ยท Posted at 18:36:37 on June 27, 2017 ยท (Permalink)

The real world doesn't work this way.

zdakat ยท 3 points ยท Posted at 21:21:40 on June 27, 2017 ยท (Permalink)

"I know one shouldn't fix what isn't broken" so why break it just to be hip?

Banur ยท 3 points ยท Posted at 21:55:34 on June 27, 2017 ยท (Permalink)

Oh my sweet summer child...

PC__LOAD__LETTER ยท 2 points ยท Posted at 23:04:28 on June 27, 2017 ยท (Permalink)

Lol. Modern languages are built on top of languages much older than 20 years old.

CrispyBacon1999 ยท 10 points ยท Posted at 17:07:31 on June 27, 2017 ยท (Permalink)

Unless it's Python

afito ยท 9 points ยท Posted at 17:34:51 on June 27, 2017 ยท (Permalink)

Yeah but if your rough draw up of a concept ends up being working and valid code things will always be different.

Throwaway-tan ยท 6 points ยท Posted at 17:34:12 on June 27, 2017 ยท (Permalink)

Basically any moderately complex SQL query.

[deleted] ยท 11 points ยท Posted at 19:04:52 on June 27, 2017 ยท (Permalink)

This shit drives me up a wall. Three thousand lines in one stored procedure because all they have is a hammer and everything looks like a goddamned nail. Especially when it's doing something that SQL sucks at, like parsing a massive URL string.

skylarmt ยท 4 points ยท Posted at 20:20:06 on June 27, 2017 ยท (Permalink)

I often do manipulation before and after a plain select from x where y=z limit [low number] query. Much nicer, even if I need to use a for loop after. Almost all the queries I write either return exactly one result or are shown as pages of (by default) 10 items.

[deleted] ยท 2 points ยท Posted at 21:04:04 on June 27, 2017 ยท (Permalink)

[deleted]

Relevant_Monstrosity ยท 7 points ยท Posted at 21:23:21 on June 27, 2017 ยท (Permalink)

Use a micro-service or n-tier architecture bro. Business logic in the data tier is bad news.

[deleted] ยท 2 points ยท Posted at 21:40:35 on June 27, 2017 ยท (Permalink)

Business logic in the data tier is bad news.

For traditional application development, yes. But if you're in a reporting-focused role (how quickly /r/programmerhumor forgets about relational databases...) then there is a lot of overlap between the data layer and the application layer as they typically are the same.

Relevant_Monstrosity ยท 2 points ยท Posted at 21:46:51 on June 27, 2017 ยท (Permalink)

I guess... I would rather do that in JS or C# than SQL any day though. Keep the data tier skinny and clean!

das7002 ยท 1 points ยท Posted at 09:25:28 on June 28, 2017 ยท (Permalink)

There's cases where it makes more sense for the RDBMS to just do everything for you, complicated joins and complex where clauses are a good example.

Some cases what you want out is easier to "explain" in SQL than in any other language, there is a lot it is good for, however using it for logic beyond data retrieval is a bit insane.

skylarmt ยท 1 points ยท Posted at 21:33:53 on June 27, 2017 ยท (Permalink)

I write a lot of PHP, and there's a great library called Medoo. You build your queries with key/value arrays and it converts them to prepared statements and returns the results as another array. It works with all the common SQL databases (MySQL, SQLite, MSSQL, etc). It goes a long way to simplifying and securing web apps (you don't have to sanitize your inputs because it does it for you).

Here's some code I wrote. The web app uses a DataTable to display the data it fetches via AJAX from that script. There's a lot of stuff before and after the actual query (lines 68-81) to process the input from the AJAX and format the output for display to the user.

It all really comes down to finding a good balance between your database server and your application server. I think that a database should be a place to put my data, and my application should actually be doing stuff with it. It's usually easier to scale app servers than it is to scale database servers and keep them in sync, which is another thing to consider.

[deleted] ยท 1 points ยท Posted at 21:36:25 on June 27, 2017 ยท (Permalink)

I don't know what you mean by "iffy string" but I just made a comment in a /r/sqlserver thread which you might be interested in.

All in all, limit SQL-like operations within your application code and you'll be fine. Meaning, if you are asking the back-end for two sets of entities and then joining them with a FOR() loop in the application, you're doing it wrong.

SoImProbablyDrunk ยท 1 points ยท Posted at 09:05:30 on June 28, 2017 ยท (Permalink)

This is why I'll never code while on mushrooms again, awesome working code... could never understand it when sober.

TheLastLivingBuffalo ยท 33 points ยท Posted at 14:37:34 on June 27, 2017 ยท (Permalink)

I just feel like it's not broken.

Ketheres ยท 28 points ยท Posted at 14:46:08 on June 27, 2017 ยท (Permalink)

Good enough. Just... if you ever doubt it, do not check it.

CityYogi ยท 14 points ยท Posted at 15:25:32 on June 27, 2017 ยท (Permalink)

Yes. Just remove the comment. If you want to be really sure that someone in future should not remove the code, put a test around it. Unit tests seemingly add value to code and make it look as part of design

skylarmt ยท 4 points ยท Posted at 20:21:18 on June 27, 2017 ยท (Permalink)

The test is just return true.

Nyfunnetland ยท 3 points ยท Posted at 22:39:28 on June 27, 2017 ยท (Permalink)

//TODO: implement test

ThatITguy2015 ยท 7 points ยท Posted at 18:49:14 on June 27, 2017 ยท (Permalink)

Until some user magically gains way more security than they should have because what you removed somehow tied into another class down below. That is fun.

HighLikeAladdin ยท 1 points ยท Posted at 03:14:57 on June 28, 2017 ยท (Permalink)

Do you happen to work for Ubisoft

nooonotthebees ยท 3 points ยท Posted at 18:02:58 on June 27, 2017 ยท (Permalink)

Yeah, who cares if it slightly messed up the runtime

Business-Socks ยท 2 points ยท Posted at 18:25:49 on June 27, 2017 ยท (Permalink)

This is going in my cube somewhere, thank you.

oalbrecht ยท 1 points ยท Posted at 19:45:48 on June 27, 2017 ยท (Permalink)

Don't forget to add a test that asserts that true equals true.

SoImProbablyDrunk ยท 1 points ยท Posted at 09:04:23 on June 28, 2017 ยท (Permalink)

Or remove it, have a simple to fix bug in your new code, have management tell you to put it all back because it worked as is (and because it takes everyone hours to understand it, it means more billable hours).

SHv2 ยท 1 points ยท Posted at 17:59:49 on June 27, 2017 ยท (Permalink)

If it compiles, it works.

PM_ME_JAR_JAR_NUDES ยท 56 points ยท Posted at 17:55:46 on June 27, 2017 ยท (Permalink)

I once investigated a //WHY DOES THIS WORK?

that I'd left in my own code months before. (debated whether to obey the English rule or the C rule for whether I should linebreak that sentence. That got weird.)

I shouldn't have. It worked. I didn't want to know the things I learned about my dependencies. Some things are best left unknown.

[deleted] ยท 51 points ยท Posted at 18:47:59 on June 27, 2017 ยท (Permalink)

Some things are best left unknown.

Reminds me when a 100-level CS professor told us the three important things to remember when implementing recursion.

  1. Always have a base case

  2. Always be sure you increment

  3. Never try to understand recursion

D0esANyoneREadTHese ยท 15 points ยท Posted at 21:14:39 on June 27, 2017 ยท (Permalink)

Did you mean Recursion ?

Blag24 ยท 7 points ยท Posted at 21:46:34 on June 27, 2017 ยท (Permalink)

Well played.

kgram ยท 9 points ยท Posted at 20:25:44 on June 27, 2017 ยท (Permalink)

In the future, just wrap the code in backticks (`), then it becomes // a more manageable comment inside text.

tsnErd3141 ยท 25 points ยท Posted at 13:36:43 on June 27, 2017 ยท (Permalink)

silently prays

purple_monkey58 ยท 5 points ยท Posted at 17:10:10 on June 27, 2017 ยท (Permalink)

Oh! It's TODO.....not Todd.....makes more sense now. Thanks

rush22 ยท 2 points ยท Posted at 00:05:41 on June 28, 2017 ยท (Permalink)

That Todo guy always leaves his work unfinished, I'm glad they fired him

chooxy ยท 6 points ยท Posted at 08:44:49 on June 28, 2017 ยท (Permalink)

bwam

THIS SUMMER

"How is he still writing comments? Wasn't he fired last week?"

bwam

PREPARE YOURSELVES

"He's in my code!"

"Mine too!"

bwam

FOR THE GEEK THRILLER OF THE YEAR

bwam

// TODO

Bromy2004 ยท 1 points ยท Posted at 02:09:46 on June 28, 2017 ยท (Permalink)

It's comments and stories like this that make me not want to learn more about programming and get into that field.

I couldn't deal with having to leave a hack job in place.

Spirit_Theory ยท 859 points ยท Posted at 13:07:16 on June 27, 2017 ยท (Permalink)

We recently had a request from the business to add a reasonably significant, but not huge feature to one of our products. I look at the code, Yeah, that'll be pretty easy, turns out there was a whole section of code there basically unused, seemingly built for the purpose. I must've written maybe 20 lines to implement it, took like half an hour plus half an hour more in testing to ensure things lined up. I feel like I opened up an old haunted mineshaft or something, that was closed for a reason, and now it's just waiting to go into production so it can wreak maximum havoc.

pixlbreaker ยท 606 points ยท Posted at 13:40:35 on June 27, 2017 ยท (Permalink)

That reminds me when I was looking at someone else's old code and the comments warned me.

// if you delete this the sky will fall on your head    
SpoliatorX ยท 318 points ยท Posted at 14:52:03 on June 27, 2017 ยท (Permalink)

I frequently write comments along the lines of // this is dark magic beyond the ken of mortals. Modify at your own risk

I've found it to be the most reliable way of stopping people fiddling with stuff they don't understand.

Smaktat ยท 544 points ยท Posted at 15:03:52 on June 27, 2017 ยท (Permalink)

Why don't you write a comment to help them understand it? You know how livid I'd be at code that's not easily understandable and then comments practically mocking my ability? Your "dark magic" is ensuring anyone who isn't the original programmer continues to fail to understand it.

That's like laughing at everyone for achieving something YOU think is better than everyone else, stomping over their professional ability with your pride and then failing to help them in the future. Is that not the sin of the industry?

Skeggiold ยท 166 points ยท Posted at 15:06:22 on June 27, 2017 ยท (Permalink)

Or encapsulate it in a function which clearly states your intention.

umopapsidn ยท 110 points ยท Posted at 17:23:21 on June 27, 2017 ยท (Permalink)

I'm self taught, my codes self documenting. If you can't read it is your fault

[deleted] ยท 66 points ยท Posted at 17:42:21 on June 27, 2017 ยท (Permalink)

[deleted]

BlandSauce ยท 46 points ยท Posted at 18:27:23 on June 27, 2017 ยท (Permalink)

Not letting anyone else see your code is a good practice, right?

umopapsidn ยท 50 points ยท Posted at 18:38:51 on June 27, 2017 ยท (Permalink)

Job security

[deleted] ยท 11 points ยท Posted at 18:50:05 on June 27, 2017 ยท (Permalink)

[deleted]

thlayli_x ยท 9 points ยท Posted at 23:01:20 on June 27, 2017 ยท (Permalink)

randomThing(things=[]){ return things[Math.rand(things.length)]; }

NoodlesInAHayStack ยท 16 points ยท Posted at 19:22:31 on June 27, 2017 ยท (Permalink)

my codes self documenting

That's a great line.

[deleted] ยท 7 points ยท Posted at 01:29:47 on June 28, 2017 ยท (Permalink)

[deleted]

umopapsidn ยท 9 points ยท Posted at 01:40:24 on June 28, 2017 ยท (Permalink)

// TODO

robisodd ยท 5 points ยท Posted at 20:34:14 on June 27, 2017 ยท (Permalink)

It self documents what it can do and how it can do it, but usually not why.

captainant ยท 9 points ยท Posted at 18:05:20 on June 27, 2017 ยท (Permalink)

triggered

ShakyG ยท 42 points ยท Posted at 15:20:32 on June 27, 2017 ยท (Permalink)

Maybe he doesn't understand how it works and found the code on Stack Overflow?

CoyoteTheFatal ยท 24 points ยท Posted at 17:41:29 on June 27, 2017 ยท (Permalink)

Yeah my assumption was that the code works but he doesn't really understand why and that's why he left the warning.

SpoliatorX ยท 44 points ยท Posted at 15:22:08 on June 27, 2017 ยท (Permalink)

Often the example I gave will follow an actual description of how it works, I add the "dark magic" part to stop people going "oh that makes sense, I'll just tweak this". Frankly the last thing I need is junior devs thinking they can help by "fixing" a complicated bug, I'd much rather they spoke to me (speak to X before modifying is another common comment) so we can work out the actual cause & solution.

I get what you're saying, but sometimes there's no point trying to explain the entirety of what's happening (and why) in a comment buried deep in the codebase. Better that the comments direct the interested party to a resource that can give proper answers (i.e. me).

LuckyHedgehog ยท 68 points ยท Posted at 15:45:22 on June 27, 2017 ยท (Permalink)

That assumes you will be working at the same company in the same position for the life of the code. What happens if you quit? Or get promoted and lose all context of the code? Or get fired?

Some other dev comes in and see "talk to /u/SpoliatorX" and are scratching their head asking "who is this guy?"

fuzzzerd ยท 4 points ยท Posted at 00:52:07 on June 28, 2017 ยท (Permalink)

While I don't work with this guy, my project has that guy. Rumor has it he quit a few years before anyone currently on the team was with the company.

SpoliatorX ยท -19 points ยท Posted at 15:58:09 on June 27, 2017 ยท (Permalink)

Due to the size of the company it's a safe assumption that the codebase will be primarily my responsibility for the forseeable future.

If I were to get fired then fuck em, it's not my problem. If I leave voluntarily then, well, it's still not my problem, but I'd at least try to note the places most likely to cause issues. Given how long we limped along in the past using legacy code that nobody fully understood I'm sure they'll be fine, at least the confusing bits have a warning now.

[deleted] ยท 66 points ยท Posted at 16:25:54 on June 27, 2017 ยท (Permalink)

Just so you know, this attitude makes you a bad team member, a bad developer, and an incredible liability to the company. I'm sure you're a hell of a programmer though.

savage884 ยท 1 points ยท Posted at 07:35:52 on June 28, 2017 ยท (Permalink)

This is like the proggit version of target fixation -> fencing response -> severe brain damage.

"Your opinion regarding our trade differs from mine? You suck and I would never hire you."

LuckyHedgehog ยท 40 points ยท Posted at 16:14:51 on June 27, 2017 ยท (Permalink)

I can't say I agree with that approach. That mentality is toxic and leads to un-maintainable code and office politics (or at least feeds into office politics).

[deleted] ยท 15 points ยท Posted at 17:27:53 on June 27, 2017 ยท (Permalink)

Why not simply comment

//if you want this to continue working, don't fire u/SpoliatorX
p1-o2 ยท 16 points ยท Posted at 17:16:17 on June 27, 2017 ยท (Permalink)

Ah, it's people like you that make my life a nightmare. I've had to resuscitate your code 10 years after it was written. That stuff usually ends up on /r/programminghorror too.

[deleted] ยท 7 points ยท Posted at 18:15:52 on June 27, 2017 ยท (Permalink)

I have worked with people with that attitude and they are not nice people.

draeath ยท 4 points ยท Posted at 20:48:18 on June 27, 2017 ยท (Permalink)

Say hello to the Bus Factor.

This is an actual thing you (and your management) should be concerned about.

termoventilador ยท 2 points ยท Posted at 22:53:54 on June 27, 2017 ยท (Permalink)

professionalism out the door

Lighthat ยท 72 points ยท Posted at 15:30:25 on June 27, 2017 ยท (Permalink)

If your code is written well it will be broken up into clear and discrete functions with specific purposes that don't require you to hand-wave things by labeling it at "dark magic." I work with massive complicated codebases that involve a lot of esoteric processing that is still straightforward to understand and modify because it was written well. Similarly I've had to dig into ancient Ada written before we had a more stringent review process and there's some barely-parseable garbage because people had the same attitude that you do, and mistake "clever" for good. If someone gets the wrong idea about the code even if you comment about it, your code is written poorly and so is your comment.

SpoliatorX ยท -15 points ยท Posted at 15:48:47 on June 27, 2017 ยท (Permalink)

I respectfully disagree. I work on a small team where there is nobody else who is fluent in the language in question. Sure they can throw together something small and it'll work, but when it comes to nuances of the environment they don't have a clue. If they get the wrong idea about the code it's usually because they don't have the requisite skills. It's dangerous for them to think they know what's happening, because they usually don't.

Yes, certainly I could document, for instance, what each SVG path command is doing, but it's much better that they go and RTFM before trying to modify things. I could also split it into separate functions, like createSVGPathLineToPointString( x, y ), but hopefully you see how ridiculous that would be. There's a limit to how much a comment can teach somebody who doesn't understand the underlying technologies properly.

Profix ยท 39 points ยท Posted at 16:06:56 on June 27, 2017 ยท (Permalink)

looks like a good method name to me

SpoliatorX ยท 0 points ยท Posted at 16:09:49 on June 27, 2017 ยท (Permalink)
function createSVGPathLineToPointString( x, y ) {
    return 'L' + x + ' ' + y;
}

Seems a bit overkill to me.

Lighthat ยท 34 points ยท Posted at 16:12:27 on June 27, 2017 ยท (Permalink)

It's not about saving lines, it's about clarifying intent and start and end states. createSVGPathLineToPointString is far more expressive than 'L' + x + ' ' + y;

SpoliatorX ยท 1 points ยท Posted at 16:20:49 on June 27, 2017 ยท (Permalink)

That's kind of my point, if I'm setting the d attribute of an SVG <path> the intent should be pretty obvious: I'm defining the shape of the path.

Carrying on from that, if I'm defining the shape of the path I should probably know the spec (https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands), at which point 'L' + x + ' ' + y becomes just as clear (IMO).

Edit: I don't think markdown liked the hash, so it's a plaintext link now

Smaktat ยท 8 points ยท Posted at 16:29:47 on June 27, 2017 ยท (Permalink)

I just wrote some code like this.

sendDiscordMessage(loachannel, "Disappointed LoA Bot v" + versionNum + " ready! Type !LoAHelp to get a message about everything I can do.");

function sendDiscordMessage(channelId, message) {
    client.Channels.get(channelId).sendMessage(message); 
}

I could be writing:

client.Channels.get(channelId).sendMessage("Disappointed LoA Bot v" + versionNum + " ready! Type !LoAHelp to get a message about everything I can do.");

everytime, but it mainly looks like garbage. In the context of a larger series of logic flow, it makes the entire scope difficult to read.

Additionally, the rule of thumb is to encapsulate your code in a function/method if it's being repeated. For one-liners I say use your judgement, but even in your example I'd make it a small function to help describe what's going on.

Framingr ยท 2 points ยท Posted at 17:29:06 on June 27, 2017 ยท (Permalink)

Looks like an NPE waiting to happen to me. But then I am coming from a Java point of view and null checking is life.

Chained dot nomenclature causes so many problems because young programmers think its cool to see how many method calls they can compress into one. Me I just see a place where one of the objects is null and I then have to debug the whole line in order to find it.

Smaktat ยท 3 points ยท Posted at 17:31:13 on June 27, 2017 ยท (Permalink)

It's an API object and there is previous work to even get to this point. I'm just trying to make a point to the OP.

e: It's Javascript as well so there's that.

Framingr ยท 2 points ยท Posted at 17:42:31 on June 27, 2017 ยท (Permalink)

Don't mind me - its just my old cranky dev coming through. I didn't mean to suggest your code was wrong. I have nothing but respect for Javascript developers, I stay the hell away from that

Smaktat ยท 1 points ยท Posted at 17:46:03 on June 27, 2017 ยท (Permalink)

You're fine lol. Likewise though, my background doesn't let a day go by where I tell myself how fortunate I am with how unstrict the language is. The respect goes both ways.

termoventilador ยท 1 points ยท Posted at 23:00:00 on June 27, 2017 ยท (Permalink)

well but being javascript, wouldnt you falsy check, if you dont expect falsy values?

fuck, i'm going to research null/undefined checking in js right now...

Lighthat ยท 7 points ยท Posted at 16:31:40 on June 27, 2017 ยท (Permalink)

It's obvious to you sure and obvious to people who are familiar with the problem domain, but not to other people. I understand your fear of people modifying things that they don't understand, and I'm not trying to convince you to let people do that, I'm saying you should write the code so that you don't have to understand to modify.

Framingr ยท 2 points ยท Posted at 17:36:52 on June 27, 2017 ยท (Permalink)

While I agree with you that in a perfect world all methods would be discrete and generic and be callable from anywhere etc etc, that kind of thinking falls apart when you are handed a code base written by the lowest bidder dev team that once saw the movie The Matrix and are now all L33T coders, and why wouldn't we have a method that's 500 lines long and contains 4 different layers of business logic? This same company will be handed back the code once you plug all the leaks, oh and do it FAST because you cost more than them and why are we paying so much for you when they are so cheap? When that happens you code as well as you can within the disaster area that is their code base and you leave comments like "Don't touch this, bad things will happen" because you know otherwise some putz from the other team will try "fix" your code and the tenuous scaffolding you have put in place to hold the whole thing up will collapse.

Green field projects like you described are few and far between and should be treasured like the precious jewel they are.

[deleted] ยท 3 points ยท Posted at 17:53:47 on June 27, 2017 ยท (Permalink)

[deleted]

Framingr ยท 0 points ยท Posted at 18:10:31 on June 27, 2017 ยท (Permalink)

What's it like up there in your ivory tower? I don't want to get into a slinging match with you but the situation you describe at your job is incredibly rare so much so that I can perhaps think of one time in more than 20 years of developing on 3 continents where I was given both the time and resources to do everything by the book. I've seen code that served millions every day that was held together by hope and sticky tape, it ran that way for years before being overhauled. The simple fact was there was neither the time nor the money to rewrite it with all the things you seem to deem mandatory. Most companies define "good code" as code that gets the job done without crashing and costing money. You start throwing around words like "future maintainability" and their eyes glaze over. On a last note, your tone here and pretty much your entire posting history have a definite odor of /r/iamverysmart. I hope for your sake you are able to stay on your current project for a goodly long while because in my experience it's people who come in with a superior attitude and unwillingness to get the work done that end up being let go.

woojoo666 ยท 1 points ยท Posted at 23:20:26 on June 27, 2017 ยท (Permalink)

Creating a new function adds about 4 lines of overhead (2 for the function name and braces, 2 for empty lines and spacing). Breaking up code into small pieces eventually yields diminishing returns and the reader is forced to jump between hundreds of tiny functions and hundreds more lines of overhead.

In this case I would say a comment explanation is more than sufficient

Lighthat ยท 2 points ยท Posted at 23:52:53 on June 27, 2017 ยท (Permalink)

We can't say what's sufficient because we don't have the rest of the code to look at. The functionality Spoilator is showing looks like something that would be used frequently, so I would assume a function is better. But if it's a once or twice off thing, then sure put a comment. It doesn't really matter what you do though, the point of the discussion is that you shouldn't just say "black magic below, beware" and call it done. Make your intent and flow clear, that's all. Functions, comments, I don't care how you do it. I'd much, much rather have inflated SLOC than unreadable code.

woojoo666 ยท 1 points ยท Posted at 01:29:52 on June 28, 2017 ยท (Permalink)

True, I don't know context, I was just explaining why it might be "overkill" as SpoliatorX stated. You originally were talking about "clarifying intent and start and end states", and my point is that sometimes it can get excessive. Frequent code use and preventing code duplication is a different matter.

Also, funny you should be mentioning lack of context because I can think of multiple situations where commenting "black magic" is fine (obviously non-ideal but hey small companies are usually non-ideal), so I don't see why SpoliatorX is getting so much flak with so little context.

mikeputerbaugh ยท 10 points ยท Posted at 16:08:29 on June 27, 2017 ยท (Permalink)

If no one else in your team is fluent enough in the language for this project to make changes, then no one else on the team has write access to the repository, and there's no problem in the first place.

Right?

SpoliatorX ยท 2 points ยท Posted at 16:12:57 on June 27, 2017 ยท (Permalink)

I wish :(

caffeinum ยท 4 points ยท Posted at 17:57:23 on June 27, 2017 ยท (Permalink)

Why won't you teach them properly first before joining to the project? Having three qualified devs on the team in more efficient in the long run

SpoliatorX ยท 2 points ยท Posted at 18:05:12 on June 27, 2017 ยท (Permalink)

Time/budget constraints: we don't have the scale to be able to fully train somebody prior to setting them to work. In an ideal world that would obviously be the preferred approach, but for the time being it's very much a learn-as-you-go kind of thing.

caffeinum ยท 3 points ยท Posted at 18:30:34 on June 27, 2017 ยท (Permalink)

I think you should talk to your manager (or, if you're one, decide for yourself). Training people beforewards pays off very quickly. As I've said, in a few time you have three devs instead of one.

You can do this using learn-as-you-go too, but you immerse with them into the tasks. First deep, then less and less deep.

Not trying to see smart, but just share from my small management experience.

SpoliatorX ยท 2 points ยท Posted at 20:04:19 on June 27, 2017 ยท (Permalink)

Yeah we normally try to give noobs something they can get their teeth into at first, we're just overstretched at the moment. Deadlines and whatnot, it's never fun. At the stage where everyone's finger is in everyone else's pie, and it's got me all stressed.

caffeinum ยท 2 points ยท Posted at 20:09:41 on June 27, 2017 ยท (Permalink)

Maybe it's reasonable at some point (as I understood, that's already going for a while) to push deadlines a lot forward, to have some time for a meta-analysis and actually breathe.

Not even saying about setting reasonable deadlines in the first place (because everyone fails at that; "Multiply your first deadline by 4 and you get the real finish time", as the saying goes).

ManEatingTitan ยท 1 points ยท Posted at 16:08:45 on June 27, 2017 ยท (Permalink)

so you're just a narsacist then

GreenFox1505 ยท 4 points ยท Posted at 19:02:19 on June 27, 2017 ยท (Permalink)

Two words: job security

Solid_Waste ยท 4 points ยท Posted at 20:57:42 on June 27, 2017 ยท (Permalink)

Did you not read the comment? IT IS BEYOND YOUR KEN

thecardq ยท 2 points ยท Posted at 00:01:35 on June 28, 2017 ยท (Permalink)

So if the original programmer doesn't understand then it's okay?

nermid ยท 2 points ยท Posted at 02:49:00 on June 28, 2017 ยท (Permalink)

I basically write code as if I'm teaching a class on it later and the comments are invisible lecture notes for me so I don't have to stand there and go, "Wait, this goes...right, right, so this part sanitizes the query" and look like a gimp in front of a bunch of sexy computer science cheerleaders who all...wait, this might be a different fantasy I'm thinking of.

savage884 ยท 1 points ยท Posted at 07:32:17 on June 28, 2017 ยท (Permalink)

Don't be so easily butt hurt. I write comments like that, too--they're a reminder that I don't understand it. :p

hithroc ยท 45 points ยท Posted at 16:03:14 on June 27, 2017 ยท (Permalink)

You might also enjoy this.

-- | This \"function\" has a superficial similarity to 'unsafePerformIO' but
-- it is in fact a malevolent agent of chaos. It unpicks the seams of reality
-- (and the 'IO' monad) so that the normal rules no longer apply. It lulls you
-- into thinking it is reasonable, but when you are not looking it stabs you
-- in the back and aliases all of your mutable buffers. The carcass of many a
-- seasoned Haskell programmer lie strewn at its feet.
--
-- Witness the trail of destruction:
--
-- * <https://github.com/haskell/bytestring/commit/71c4b438c675aa360c79d79acc9a491e7bbc26e7>
--
-- * <https://github.com/haskell/bytestring/commit/210c656390ae617d9ee3b8bcff5c88dd17cef8da>
--
-- * <https://ghc.haskell.org/trac/ghc/ticket/3486>
--
-- * <https://ghc.haskell.org/trac/ghc/ticket/3487>
--
-- * <https://ghc.haskell.org/trac/ghc/ticket/7270>
--
-- Do not talk about \"safe\"! You do not know what is safe!
--
-- Yield not to its blasphemous call! Flee traveller! Flee or you will be
-- corrupted and devoured!
SpoliatorX ยท 14 points ยท Posted at 16:06:07 on June 27, 2017 ยท (Permalink)

Do not talk about \"safe\"! You do not know what is safe!

Yeah, that was the good stuff. I'm in awe, I have so much still to learn!

XkF21WNJ ยท 11 points ยท Posted at 19:50:26 on June 27, 2017 ยท (Permalink)
inlinePerformIO :: IO a -> a 
inlinePerformIO = accursedUnutterablePerformIO
{-# INLINE inlinePerformIO #-} 
{-# DEPRECATED inlinePerformIO 
 "If you think you know what you are doing, use 'unsafePerformIO'. 
  If you are sure you know what you are doing, use 'unsafeDupablePerformIO'. 
  If you enjoy sharing an address space with a malevolent agent of chaos, 
  try 'accursedUnutterablePerformIO'." #-}

What on earth?

calfuris ยท 3 points ยท Posted at 05:54:15 on June 28, 2017 ยท (Permalink)

Heh, I'm glad to see people appreciated this :-)

I was getting tired of answering quesitons along the lines of "why is this an unsafe use of inlinePerformIO?". I wanted to say "you don't ask why it's an unsafe use, but must justify why it is a safe use". So I decided to change the name and improve the documentation to disuade the unwary from using it. Hopefully this is sufficient :-)

src

Tarmen ยท 1 points ยท Posted at 22:54:26 on June 28, 2017 ยท (Permalink)

Basically, imagine IO as a list of actions:

  • Normal IO executes them in the correct order
  • unsafeInterleaveIO executes an action where it is written, some later date or not at all. Used for lazy IO and threading
  • unsafePerformIO executess IO anytime including before it is written, used if you just don't care as long as the data is there when needed
  • unsafeDupablePerformIO removes locking so an IO action can be started on two threads simultaneously if they both require the data. If the slower thread realizes what is happening it may kill the action without throwing an exception as it'd do with pure code so don't allocate resources here
  • unsafeInlinePerformIO makes the compiler handle IO like it would pure code, so if you had two malloc calls they would return the same pointer. Incredibly unsafe if you allocate or mutate memory but neat optimizations if you only read from memory. Using it is almost certainly a terrible idea, though
Striving_Sun ยท 5 points ยท Posted at 17:02:26 on June 27, 2017 ยท (Permalink)

// god bless this spaghetti mess

ShreveportKills ยท 3 points ยท Posted at 18:43:21 on June 27, 2017 ยท (Permalink)

// RIP whomever is editing the code below

nermid ยท 1 points ยท Posted at 02:52:17 on June 28, 2017 ยท (Permalink)

I ran across a section of code prefaced with a long comment about just letting the Frankenquery have its way with you while you think of the programming gods or something. It urged me not to modify the Frankenquery, for it would surely destroy me.

I had to modify the Frankenquery. It took two days. I hope never to touch that file again.

[deleted] ยท 8 points ยท Posted at 15:20:33 on June 27, 2017 ยท (Permalink)

[deleted]

aiij ยท 5 points ยท Posted at 17:19:36 on June 27, 2017 ยท (Permalink)

AKA, "fiddling with stuff they don't understand."

monarchmra ยท 3 points ยท Posted at 22:14:13 on June 27, 2017 ยท (Permalink)

https://github.com/tgstation/tgstation/blob/master/code/modules/client/client_defines.dm#L4

Taking the type the engine creates to represent connected clients and rejiggering its inheritance. #JustBlackMagicThings

[deleted] ยท 2 points ยท Posted at 19:01:46 on June 27, 2017 ยท (Permalink)

This guy fucks

Gh0stWalrus ยท 3 points ยท Posted at 16:45:07 on June 27, 2017 ยท (Permalink)

Neckbeard humor eh?

phunanon ยท 9 points ยท Posted at 15:12:39 on June 27, 2017 ยท (Permalink)

I love the pure lore something as primitive and harmless as a text file can create in this world. Only programmers understand.

jl2352 ยท 39 points ยท Posted at 17:19:10 on June 27, 2017 ยท (Permalink)

Reminds me of that company Knights Capital. They reused an old constant for a new feature, which turned on Power Peg! A feature that hand't been used in a decade. When it hit production it had a bug that lost them $440 million within 45 minutes, and the company almost went bankrupt.

Anywho, good luck getting your old/new feature shipped!

justfor1t ยท 22 points ยท Posted at 19:15:52 on June 27, 2017 ยท (Permalink)
u1tralord ยท 7 points ยท Posted at 04:02:08 on June 28, 2017 ยท (Permalink)

Holy shit, that's awful.

That was a good read though. Thanks for linking it

serialdormeur ยท 39 points ยท Posted at 13:27:09 on June 27, 2017 ยท (Permalink)

Did you git blame said section to ask the author why it ended up not being used?

aiij ยท 45 points ยท Posted at 17:22:13 on June 27, 2017 ยท (Permalink)

The answer to that should be obvious...

fatal: Not a git repository (or any of the parent directories): .git

VivaLaPandaReddit ยท 8 points ยท Posted at 19:02:10 on June 27, 2017 ยท (Permalink)

This is the spookiest part.

nermid ยท 1 points ยท Posted at 02:53:24 on June 28, 2017 ยท (Permalink)

THEN WHO WAS COMMIT?!

cowmandude ยท 16 points ยท Posted at 14:14:47 on June 27, 2017 ยท (Permalink)

The users get what they ask for whether they like it or not!

whizzer0 ยท 3 points ยท Posted at 14:55:02 on June 27, 2017 ยท (Permalink)

Why do I have you tagged with "tรฉlรฉphone"?

serialdormeur ยท 10 points ยท Posted at 15:26:29 on June 27, 2017 ยท (Permalink)
[deleted] ยท 1 points ยท Posted at 03:22:24 on June 28, 2017 ยท (Permalink)

The custom fair should link to the comment you assigned the flair for

SystemicPlural ยท 12 points ยท Posted at 15:25:16 on June 27, 2017 ยท (Permalink)

It was probably a project that got put on hold at the last minute when the client/boss found a new thing that they must have implemented right now.

mauxly ยท 33 points ยท Posted at 15:53:45 on June 27, 2017 ยท (Permalink)

I have huge chunks of commented out code in by base just ready to be implemented. I keep my ears to the ground, anticipating what the next request will be and code it all up when I have extra time.

They think I'm magic.

I'll be totally screwed when I didn't anticipate something and it actually takes me time to code it up.

Sir_Omnomnom ยท 27 points ยท Posted at 17:25:59 on June 27, 2017 ยท (Permalink)

Simple. Code everything. Then sell that file to all the companies.

PossiblyaShitposter ยท 17 points ยท Posted at 17:43:54 on June 27, 2017 ยท (Permalink)

Perfect code that can do everything must be infinitely large.

But perfect code is also infinitely concise.

Fuck.

Sir_Omnomnom ยท 17 points ยท Posted at 18:05:24 on June 27, 2017 ยท (Permalink)

In that code, you would have a perfect compression algorithm. Use that.

PossiblyaShitposter ยท 5 points ยท Posted at 18:08:57 on June 27, 2017 ยท (Permalink)

Holy shit.

Did you know that you have a halo behind your head?

Sir_Omnomnom ยท 4 points ยท Posted at 19:59:46 on June 27, 2017 ยท (Permalink)

Yes.

crowhorn52 ยท 2 points ยท Posted at 21:42:20 on June 27, 2017 ยท (Permalink)

This is my life. I'm a QA and we just pulled some work from patches - rollbacks on some but not all code. I can't wait for the siren.

DoesntReadMessages ยท 1 points ยท Posted at 20:40:31 on June 28, 2017 ยท (Permalink)

Same man...in a codebase with a 90% code coverage unit test policy, and it was uncovered. Literally wrote 6 unit tests, they passed. Wrote 2 integration tests and uncommented a line, and they passed. Asked the guy who was on the Git blame and he didn't write it, he just migrated the package.

shudder

allvoid ยท 145 points ยท Posted at 14:22:58 on June 27, 2017 ยท (Permalink)

I love the bugs that appeared

jakx102 ยท 69 points ยท Posted at 15:55:19 on June 27, 2017 ยท (Permalink)

They are features not bugs

GreenFox1505 ยท 20 points ยท Posted at 19:03:34 on June 27, 2017 ยท (Permalink)

Lol, I didn't even realize that. I was thinking "why are there ants down there?"

Vrigoth ยท 1 points ยท Posted at 07:05:37 on June 28, 2017 ยท (Permalink)

I thought it was a crying rock.

grabs another coffee

๐ŸŽ™๏ธ taires ยท 391 points ยท Posted at 11:11:09 on June 27, 2017 ยท (Permalink)
googolem ยท 141 points ยท Posted at 12:58:44 on June 27, 2017 ยท (Permalink)

Thank you for including the source

2Punx2Furious ยท 83 points ยท Posted at 13:54:42 on June 27, 2017 ยท (Permalink)

Thank you for thanking them for including the source.

ballroomaddict ยท 72 points ยท Posted at 14:01:42 on June 27, 2017 ยท (Permalink)

Thank you for thanking them for thanking them for inc- STACK OVERFLOW

Argetlam_Elda ยท 45 points ยท Posted at 15:16:00 on June 27, 2017 ยท (Permalink)

This has to be the most inefficient recursive function of all time.

Isarian ยท 15 points ยท Posted at 17:11:11 on June 27, 2017 ยท (Permalink)

This has to be the most inefficient recursive function of recursive function of all time.

UnknownNam3 ยท 5 points ยท Posted at 19:15:36 on June 27, 2017 ยท (Permalink)

Thank you for pointing that out.

kyrexar ยท 4 points ยท Posted at 20:04:08 on June 27, 2017 ยท (Permalink)

Thank you for thanking him for pointing that out.

MarvelousBilly ยท 4 points ยท Posted at 22:21:33 on June 27, 2017 ยท (Permalink)

Thank you for thanking them for thanking them for inc- STACK OVERFLOW

challah_is_bae ยท 4 points ยท Posted at 21:39:01 on June 27, 2017 ยท (Permalink)

But by far the most Canadian

andrybak ยท 1 points ยท Posted at 18:13:52 on June 27, 2017 ยท (Permalink)

Maybe it was just a small stack?

drkalmenius ยท 7 points ยท Posted at 16:05:30 on June 27, 2017 ยท (Permalink)

This thread has been protected to eliminate responses like 'thanks' and 'me too'

profound7 ยท 2 points ยท Posted at 04:56:35 on June 28, 2017 ยท (Permalink)

Thanks. Me too.

DutchmanDavid ยท 17 points ยท Posted at 14:07:23 on June 27, 2017 ยท (Permalink)

Looks like OP is actually the creator (seeing the tag /u/taires has).

๐ŸŽ™๏ธ taires ยท 27 points ยท Posted at 15:14:51 on June 27, 2017 ยท (Permalink)

/u/cstefanache is the one who draws them, I help him with ideas and keep him in line .. so a co-creator.

DutchmanDavid ยท 4 points ยท Posted at 15:38:32 on June 27, 2017 ยท (Permalink)

Aaah, I see. Thanks for giving props!

alexwangombe ยท 3 points ยท Posted at 18:17:23 on June 27, 2017 ยท (Permalink)

Thank you for thanking them for giving props!

googolem ยท 2 points ยท Posted at 15:04:04 on June 27, 2017 ยท (Permalink)

I hadn't noticed that. Either way I'm happy that there's a link to the source so that I can see more of those comics

๐ŸŽ™๏ธ taires ยท 1 points ยท Posted at 14:59:28 on June 27, 2017 ยท (Permalink)

You're welcome bud

APSmiler ยท 15 points ยท Posted at 13:12:35 on June 27, 2017 ยท (Permalink)

Memes with sauce are always better than memes without.

t0nyrs ยท 7 points ยท Posted at 14:10:22 on June 27, 2017 ยท (Permalink)

Just don't get lost in the sauce.

volabimus ยท 11 points ยท Posted at 14:48:53 on June 27, 2017 ยท (Permalink)
[deleted] ยท 57 points ยท Posted at 14:38:10 on June 27, 2017 ยท (Permalink)

That's great, they even included some features having diner in the bottom right.

anOldMeme ยท 2 points ยท Posted at 23:29:45 on June 27, 2017 ยท (Permalink)

// features not bugs

electrius ยท 131 points ยท Posted at 13:49:27 on June 27, 2017 ยท (Permalink)

//TODO Todo

Todotodotodo

Todo todooooo

(Pink panther)

marcosdumay ยท 51 points ยท Posted at 14:14:59 on June 27, 2017 ยท (Permalink)

You'd better use the /* syntax for that comment.

Pm_me_any_dragon ยท 118 points ยท Posted at 14:52:26 on June 27, 2017 ยท (Permalink)
*/

CAREFUL FELLOW FLESHBAG. YOU MADE THE REST OF THE THREAD UNREADABLE

Learning25 ยท 16 points ยท Posted at 14:55:50 on June 27, 2017 ยท (Permalink)

Thank you for saving us

2girly4me ยท 22 points ยท Posted at 14:58:33 on June 27, 2017 ยท (Permalink)

/* Runs

Edit: two people just closed the comment. We weren't careful Reddit!

Sudo-Pseudonym ยท 19 points ยท Posted at 15:21:34 on June 27, 2017 ยท (Permalink)

*/

Careful!

louis_A12 ยท 3 points ยท Posted at 15:23:48 on June 27, 2017 ยท (Permalink)

*/

FedeWar ยท 6 points ยท Posted at 16:21:04 on June 27, 2017 ยท (Permalink)

We need a bot for this

Pm_me_any_dragon ยท 12 points ยท Posted at 16:26:04 on June 27, 2017 ยท (Permalink)

WHY WOULD WE NEED A BOT WHEN US FLESHBAGS ARE ENOUGH?

XkF21WNJ ยท 3 points ยท Posted at 19:55:29 on June 27, 2017 ยท (Permalink)
//*/

Better safe than sorry.

FeebTube ยท 10 points ยท Posted at 15:55:51 on June 27, 2017 ยท (Permalink)

//TODO KETE SETSUNASA NI WA

Alvaronv ยท 2 points ยท Posted at 16:10:05 on June 27, 2017 ยท (Permalink)
Aschentei ยท 2 points ยท Posted at 18:28:02 on June 27, 2017 ยท (Permalink)

I was waiting for someone to post this. Thank you

dazdadon ยท 156 points ยท Posted at 11:49:41 on June 27, 2017 ยท (Permalink)

//TODO

write witty comment

jackdeansmithsmith ยท 69 points ยท Posted at 13:54:51 on June 27, 2017 ยท (Permalink)

I do this way too much.

//TODO handle possible error is also way too common.

dazdadon ยท 32 points ยท Posted at 14:01:45 on June 27, 2017 ยท (Permalink)
//TODO add more validation
[deleted] ยท 29 points ยท Posted at 14:58:19 on June 27, 2017 ยท (Permalink)

[deleted]

Skipachu ยท 16 points ยท Posted at 15:24:24 on June 27, 2017 ยท (Permalink)

It's a reminder to return to the rivers and lakes you're used to.

alexwangombe ยท 3 points ยท Posted at 18:19:30 on June 27, 2017 ยท (Permalink)

Amazing

k1p1coder ยท 5 points ยท Posted at 21:24:45 on June 27, 2017 ยท (Permalink)

Put on a rain poncho and run it in debug...

ElTalOscar ยท 5 points ยท Posted at 20:55:17 on June 27, 2017 ยท (Permalink)

One of the things that I hate the most about myself is my compulsion to write reminders with very dark references or code words which meaning I later can't figure out.

TheNorthComesWithMe ยท 20 points ยท Posted at 14:58:13 on June 27, 2017 ยท (Permalink)
//TODO this line makes the code work, figure out why
dazdadon ยท 13 points ยท Posted at 16:01:00 on June 27, 2017 ยท (Permalink)

Not a TODO but I've seen

//Magic, Don't touch

spoiler: I touched, and it broke

[deleted] ยท 12 points ยท Posted at 16:10:53 on June 27, 2017 ยท (Permalink)

Reminds me of this story

[deleted] ยท 1 points ยท Posted at 00:03:14 on June 28, 2017 ยท (Permalink)

Did you mean: my entire codebase?

alexbuzzbee ยท 3 points ยท Posted at 19:21:36 on June 27, 2017 ยท (Permalink)

// TODO: This line is probably the bug, find out why.

Gudin ยท 20 points ยท Posted at 13:22:07 on June 27, 2017 ยท (Permalink)

But what when you find just "//TODO" (no additional comment), as I did last week?

Sylvartas ยท 38 points ยท Posted at 13:45:27 on June 27, 2017 ยท (Permalink)

return true;

dazdadon ยท 18 points ยท Posted at 14:04:14 on June 27, 2017 ยท (Permalink)

That just means whatever is needed //TODO is way out of your league, consult a a developer with the longest beard around you.

Baka-san ยท 5 points ยท Posted at 14:38:40 on June 27, 2017 ยท (Permalink)

And/or the greyest. He has seen some shit.

Ketheres ยท 10 points ยท Posted at 14:47:17 on June 27, 2017 ยท (Permalink)

But our Greybeard is a woman. Her beard is very long though.

Baka-san ยท 8 points ยท Posted at 15:21:11 on June 27, 2017 ยท (Permalink)

Guess I should have said "they", I just translated it the way I'd say it in my native language. But a female Greybeard is totally fine, too.

yboc0 ยท 5 points ยท Posted at 13:51:37 on June 27, 2017 ยท (Permalink)

Just delete it and hope for the best.

jsideris ยท 27 points ยท Posted at 15:35:17 on June 27, 2017 ยท (Permalink)

How a TODO evolves into a FIXME.

[deleted] ยท 45 points ยท Posted at 13:53:28 on June 27, 2017 ยท (Permalink)

A front end dev would just chop it off with some scissors

rentar42 ยท 36 points ยท Posted at 15:52:56 on June 27, 2017 ยท (Permalink)

with scissors?

jarrettmunton ยท 18 points ยท Posted at 15:34:26 on June 27, 2017 ยท (Permalink)

I've been staring at code so much that I saw "// TODO" and my brain just automatically triggered it as just as a generic "something to do", not even thinking about programming, so I thought this was r/funny and as a result this made NO sense. Now I know how "normal people" feel when they see r/programmerhumor.

b1tstream ยท 68 points ยท Posted at 13:13:29 on June 27, 2017 ยท (Permalink)

//TODO: get off Reddit and do some work

pekkhum ยท 23 points ยท Posted at 13:20:30 on June 27, 2017 ยท (Permalink)

//TODO: get off Reddit and go to work

[deleted] ยท 33 points ยท Posted at 13:39:45 on June 27, 2017 ยท (Permalink)

//TODO: Get off reddit and get a job.

[deleted] ยท 13 points ยท Posted at 13:44:49 on June 27, 2017 ยท (Permalink)

[deleted]

Pm_me_any_dragon ยท 1 points ยท Posted at 14:53:46 on June 27, 2017 ยท (Permalink)

//TODO witty comment

bass-lick_instinct ยท 5 points ยท Posted at 15:55:39 on June 27, 2017 ยท (Permalink)
//TADA! I have no idea how this works 
TheLync ยท 8 points ยท Posted at 17:50:02 on June 27, 2017 ยท (Permalink)

//TOTO

Bless the rains down in Africa

HeyItsShuga ยท 5 points ยท Posted at 13:46:10 on June 27, 2017 ยท (Permalink)

//TODO: Get off reddit and write a resume.

dabius ยท 1 points ยท Posted at 11:14:33 on June 28, 2017 ยท (Permalink)

//TODO: get off

Moarton ยท 15 points ยท Posted at 14:19:02 on June 27, 2017 ยท (Permalink)

The bugs just had to be in there.

beavertime ยท 11 points ยท Posted at 14:33:19 on June 27, 2017 ยท (Permalink)

// TODO defend my professional reputation and conscience by vaguely alluding to possible deficiencies...my work is done here

sexxndruxx ยท 8 points ยท Posted at 14:47:20 on June 27, 2017 ยท (Permalink)

At first i thought this was a spanish meme about reddit when i saw //TODO which translates to //ALL in spanish.

MarioPL98 ยท 6 points ยท Posted at 14:28:44 on June 27, 2017 ยท (Permalink)
gntheprogrammer ยท 5 points ยท Posted at 18:27:11 on June 27, 2017 ยท (Permalink)

//TODO remove

//TODO cleanup

//TODO refactor the entire codebase

8lazy ยท 2 points ยท Posted at 11:42:57 on June 28, 2017 ยท (Permalink)

Too familiar...

Armond436 ยท 16 points ยท Posted at 13:46:14 on June 27, 2017 ยท (Permalink)

Yeah. Two hours in I was asking myself why collisions were breaking because of the changes I made to our sound manager.

Seriously, Dave, encapsulate your shit!

socrates200X ยท 3 points ยท Posted at 17:34:50 on June 27, 2017 ยท (Permalink)

You have a Dave, too? Why is it always Dave?

Armond436 ยท 3 points ยท Posted at 19:55:06 on June 27, 2017 ยท (Permalink)
bass-lick_instinct ยท 5 points ยท Posted at 15:57:53 on June 27, 2017 ยท (Permalink)

//TODO: fix this ASAP!!! - bass-lick_instinct April 12th 2004

Bro_Sam ยท 4 points ยท Posted at 16:23:25 on June 27, 2017 ยท (Permalink)

Nice touch adding the "bugs" in the last panel

JizzedInMyBall ยท 4 points ยท Posted at 19:12:15 on June 27, 2017 ยท (Permalink)

Love the subtle bugs in the ground

TyroshiSellsword ยท 2 points ยท Posted at 19:13:31 on June 27, 2017 ยท (Permalink)

They look like they're having tea.

JizzedInMyBall ยท 2 points ยท Posted at 19:22:21 on June 27, 2017 ยท (Permalink)

It's the saddest and most adorable thing I've seen so far

thepotatochronicles ยท 3 points ยท Posted at 15:31:41 on June 27, 2017 ยท (Permalink)

Ouch. Too close to home.

nthcxd ยท 3 points ยท Posted at 17:19:44 on June 27, 2017 ยท (Permalink)

Nothing is more permanent than a temporary solution. - old Russian proverb

kadzoodle ยท 3 points ยท Posted at 20:31:49 on June 27, 2017 ยท (Permalink)

Haha I am definitely not from r/all and I completely understand the joke my fellow hackermans

SkoobyDoo ยท 3 points ยท Posted at 20:50:39 on June 27, 2017 ยท (Permalink)

I recently ran into a TODO block I had left behind on some code that has snuck its way to production. Let me dig up the exact comment...

try {
  ...
}
catch (e) {
  // this is probably an exception receiving the value.
  // TODO: more eloquently?
}

Naturally, I backed away slowly.

ButiBori ยท 7 points ยท Posted at 14:46:12 on June 27, 2017 ยท (Permalink)

Here from frontpage. Can someone explain me the joke please?

otakuman ยท 7 points ยท Posted at 18:53:14 on June 27, 2017 ยท (Permalink)

A troublesome piece of code which has become a dependency of too much other stuff. Years later, you can't fix it without changing ALL that other code (the analogy is that the code grew roots, and you should've fixed it way earlier).

In cases like this, you need to "refactor" lots of code, one by one, JUST to change how the code is structured without altering its behavior; once you refactor, then you need to do lots of tests to verify that nothing breaks. If it does, you did something wrong.

Personally, I've wasted hours on refactoring code to see it all fall down on execution. Then I have to revert all my changes and start over, looking for a simpler way to change things (i.e. instead of fixing all the code, you introduce a new procedure or variable or type to encapsulate the problem, making things easier to manage.

It's as much an art as a science, as you'll depend on new creative ways to fix that mess.

And finally, FINALLY, when you've finished refactoring, you can only then proceed to fix the damn bug.

GKoala ยท 18 points ยท Posted at 15:04:38 on June 27, 2017 ยท (Permalink)

My limited knowledge; its a coding humor. // means comment in code and won't actually register as part of the code. It's a note saying the weed is something that needs to be taken care of but in code "fixing" one thing often leads to more problems.

rentar42 ยท 15 points ยท Posted at 15:54:58 on June 27, 2017 ยท (Permalink)

Right. Often the small thing that the "TODO" comment points at is a symptom of a much bigger issue and the process of trying to fix it leaves the codebase in a worse position, unless one goes the extra mile to actually fix the underlying problem (which can take a very long time in some cases).

This is also usually the reason why the original author added the TODO comment instead of just fixing the code.

Morlunapp ยท 2 points ยท Posted at 15:07:00 on June 27, 2017 ยท (Permalink)

//TODO tidy

[deleted] ยท 2 points ยท Posted at 18:53:05 on June 27, 2017 ยท (Permalink)

Wait, people actually get time to refactor old code and processes?!

DoomWolf135 ยท 2 points ยท Posted at 19:02:40 on June 27, 2017 ยท (Permalink)

TODO means "everything" in spanish. Hmm...

pukesickle ยท 2 points ยท Posted at 21:17:26 on June 27, 2017 ยท (Permalink)

This is what being a homeowner is like.

k1p1coder ยท 2 points ยท Posted at 21:28:57 on June 27, 2017 ยท (Permalink)

True. Except the bugs there look more termite-y.

GameOfVotes ยท 2 points ยท Posted at 01:03:36 on June 28, 2017 ยท (Permalink)

Git reset --hard

[deleted] ยท 5 points ยท Posted at 14:15:39 on June 27, 2017 ยท (Permalink)

This is 100% the best one I've seen on this sub. So true.

[deleted] ยท 1 points ยท Posted at 17:12:06 on June 27, 2017 ยท (Permalink)

That's super inaccurate. In real life nobody never ever touches TODO'ed code. It's just another junk comment. In my IDEs I even remove highlights for TODOes and use my own format for todo comments. And I use git push guards to make sure that my todoes never reach another person.

KnifeToStabYou ยท 1 points ยท Posted at 17:14:09 on June 27, 2017 ยท (Permalink)

I will fix it tomorrow.

WhatsGoingOnAnymore ยท 1 points ยท Posted at 17:40:47 on June 27, 2017 ยท (Permalink)

The bugs looked like a sad tree root in the ground. Made me have some feels for a sec..

kwikcarlube ยท 1 points ยท Posted at 17:48:06 on June 27, 2017 ยท (Permalink)

When I opened this it was just the Reddit loading icon for a good while... and I thought that was the joke. Then it loaded.

[deleted] ยท 1 points ยท Posted at 18:14:20 on June 27, 2017 ยท (Permalink)

me three hours ago ;_;

GoogleyEyedNopes ยท 1 points ยท Posted at 18:16:36 on June 27, 2017 ยท (Permalink)

But... that's a single line comment.

MartinCorwin ยท 1 points ยท Posted at 18:34:42 on June 27, 2017 ยท (Permalink)

Spaghetti code looks like a gordian knot as long as you refrain from pulling on a thread. But if you do, it will fall apart quickly.

1SweetChuck ยท 1 points ยท Posted at 18:36:13 on June 27, 2017 ยท (Permalink)

Still better than:

try {
  .
  .
  .
} catch (Exception e) { 
  //TODO
}
guptauv ยท 1 points ยท Posted at 20:07:49 on June 27, 2017 ยท (Permalink)

Who are those two little green guys in the bottom right corner?

k1p1coder ยท 2 points ยท Posted at 21:18:35 on June 27, 2017 ยท (Permalink)

Bugs that got uncovered I think.

irqlnotdispatchlevel ยท 1 points ยท Posted at 20:22:47 on June 27, 2017 ยท (Permalink)

/// TODO: remove all outdated TODOs from this file

Camdennn ยท 1 points ยท Posted at 20:31:20 on June 27, 2017 ยท (Permalink)

Just control+z. It's undo

k1p1coder ยท 1 points ยท Posted at 20:43:27 on June 27, 2017 ยท (Permalink)

And this is why I always make a full copy of my entire project and put it somewhere safe before I start touching code I haven't touched in six months.

Yes, even with source control.

Can't be too careful. Best to have an eject button.

fresh-beej ยท 1 points ยท Posted at 20:52:12 on June 27, 2017 ยท (Permalink)

LOL

DotKyuu ยท 1 points ยท Posted at 22:12:06 on June 27, 2017 ยท (Permalink)

Or cut it ?

EyesEmojiPeachEmoji ยท 1 points ยท Posted at 23:15:27 on June 27, 2017 ยท (Permalink)

Version control tho

CoastalDistractions ยท 1 points ยท Posted at 00:28:55 on June 28, 2017 ยท (Permalink)

At least he did a pull first.

MAGAnificentOne ยท 1 points ยท Posted at 00:39:43 on June 28, 2017 ยท (Permalink)

Cntrl + H

"//TODO"

""

Br3ttl3y ยท 1 points ยท Posted at 14:31:12 on June 27, 2017 ยท (Permalink)

Right in the feels.