• Hey Guest. Check out your NeoGAF Wrapped 2025 results here!

GAF Devs Thread - a thread about programmer's rants

Status
Not open for further replies.
ahah reminds of this one time a new hire was complaining about his cursor hanging.

I looked at it

cursor c1 is

select SYSDATE from dual;

For c1_rec in c1
Loop
...


I felt bad later cause I laughed so hard I nearly cried.

I don't know what's wrong with this. But it's not from MSSQL, is it? That's what I'm used to.
 
God, I hate Access. I think some of my environment variables are messing with its ability to find my Oracle wallet, so I can't connect via ODBC.
 
a couple of weeks ago i was visiting my brother (who is a dev as well) and while i was there he made me read this book
41znMZniZ1L._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA300_SH20_OU01_.jpg

http://www.amazon.com/dp/0132350882/?tag=neogaf0e-20

and watch some of the related videos
http://www.cleancoders.com/

i've gotta say that while i've always tried to keep my code as clean as possible i never went to the extent of writing methods no longer then four lines...

i've been trying to apply the methods described in both the books and the videos and i gotta say that it has really been an eye-opening experience so far.

am i late to the party or none of you ever heard of it? what do you think about it?
 
i've gotta say that while i've always tried to keep my code as clean as possible i never went to the extent of writing methods no longer then four lines...

That is the definition of bad practice that leads to unreadable code with thousands of methods that make it difficult to navigate a codebase.

A better rule of thumb might be a method should not generate more than 4 levels stack levels or more than 4 branches internally.

In other words, measure it via cyclomatic complexity instead of raw lines.
 
Let's not forget this coming by for a visit randomly only on some PC's.

TheExpressionOnClick_thumb.jpg

Oooh.....I hate that message.
I have found that the only reliable way to fix it is to cut out all of the code from the project window, paste it into a text file, save, compact & repair, then paste it back in.
 
i've gotta say that while i've always tried to keep my code as clean as possible i never went to the extent of writing methods no longer then four lines...

i've been trying to apply the methods described in both the books and the videos and i gotta say that it has really been an eye-opening experience so far.

am i late to the party or none of you ever heard of it? what do you think about it?

While it's a good idea in theory, the problem is that it's a relatively arbitrary number that doesn't work as a catch-all. Trying to keep the code as concise as possible is a nice thing, but readability and the threat of having to return to it wholly trumps minimilistic methods. You shouldn't cram everything into a single method, but excising it to jive with the number is just as bad. Methods should be like a woman's skirt- long enough to cover the essentials, but short enough to keep them interesting.
 
That is the definition of bad practice that leads to unreadable code with thousands of methods that make it difficult to navigate a codebase.

A better rule of thumb might be a method should not generate more than 4 levels stack levels or more than 4 branches internally.

In other words, measure it via cyclomatic complexity instead of raw lines.

that was my same thought, but you actually get a lot of reusability for your methods... on the classes i tried this i actually reduced the number of lines the class was made of.

the method suggest to use long names for private methods and make them as much descriptive as possible, making the code to read like well written prose.

also applying this method you often see that inside your class methods there are actually hidden classes.
 
i've gotta say that while i've always tried to keep my code as clean as possible i never went to the extent of writing methods no longer then four lines...

Yeah, about that.. last week at work, I found a method with a length of about 550 lines. It's basically a huge if-elsif-elsif-etc tree full with redundancies. Just terrible.

The book seems to be a nice read, I started reading a few days ago.

By the way, Access guys: I found out it's possible to have tabs for all opened tables/queries. Why the hell isn't this enabled by default? The option is in the Current Database section of the Access settings.
 
Yeah, about that.. last week at work, I found a method with a length of about 550 lines. It's basically a huge if-elsif-elsif-etc tree full with redundancies. Just terrible.

The book seems to be a nice read, I started reading a few days ago.

By the way, Access guys: I found out it's possible to have tabs for all opened tables/queries. Why the hell isn't this enabled by default? The option is in the Current Database section of the Access settings.

Yea, I have seen lots of those at work too. But I don't work in the R&D department that I can do anything about them.

I generally hate arbitrary guidelines for writing code. 4 lines per method would not be possible where I work, although i guess it depends on the definition of lines...
 
Yea, I have seen lots of those at work too. But I don't work in the R&D department that I can do anything about them.

I generally hate arbitrary guidelines for writing code. 4 lines per method would not be possible where I work, although i guess it depends on the definition of lines...

Amen brother. Common sense above all!

Ugh, to this date I don't know what's worse to read and debug: behemoth sized or "tiny super nested" methods.
 
Not sure if there are any other Computer Science students like myself in here but... I always read my assignment sheets for my current programming class and think to myself "Ah, that doesn't sound so bad."

Then it gets be a few days before the program is due and I start panicking after I sit down and try to code some of it because shit doesn't work like I thought it would.

I really need to start respecting the time given to us for these things instead of putting it off so much.
 
Not sure if there are any other Computer Science students like myself in here but... I always read my assignment sheets for my current programming class and think to myself "Ah, that doesn't sound so bad."

Then it gets be a few days before the program is due and I start panicking after I sit down and try to code some of it because shit doesn't work like I thought it would.

I really need to start respecting the time given to us for these things instead of putting it off so much.
Despite having very little experience with it, I have learned quickly that rule #1 of programming assignments: start it the day you're given the task. It will ALWAYS take longer than you expect it to. Unexpected bugs will pop up, and you will be stumped for how to fix them unless you're way above the level of the course you're taking. (I'm in Software engineering)
 
Four lines per method seems excessive, ironically. But I guess it's doable for a simple processes.

Code:
class KillYourself
  def initialize
   give_away_stuff
   write_note
   die
  end

  def give_away_stuff
    attributes.each do |k, v|
      self[k] = nil
    end
  end

  def write_note
    puts 'I am going to die now.'
  end

  def die
    throw 'FatalError'
  end
end


I have a macabre sense of humor.
 
Not sure if there are any other Computer Science students like myself in here but... I always read my assignment sheets for my current programming class and think to myself "Ah, that doesn't sound so bad."

Then it gets be a few days before the program is due and I start panicking after I sit down and try to code some of it because shit doesn't work like I thought it would.

I really need to start respecting the time given to us for these things instead of putting it off so much.

Nothing beats debugging your program couple of hours before it's due trying to find that one bug that is messing up the entire output.
 
I'm not agreeing with n-or-less-lines-functions, but with the principle that a function should do exactly one thing. Though I'm not that strict about it - if I feel that any second thing would fit perfectly in a function, I put it in. So yes, common sense above all.
 
Four lines per method seems excessive, ironically. But I guess it's doable for a simple processes.

Code:
Ruby Code


I have a macabre sense of humor.

Yeah, it's such an arbitrary limit. I know it's trying to be readable, but you can't compare the freedom of expresion between 4 lines of ruby with 4 lines of php. Trying to only have 4 line methods in php must be a nightmare.
 
Yeah, it's such an arbitrary limit. I know it's trying to be readable, but you can't compare the freedom of expresion between 4 lines of ruby with 4 lines of php. Trying to only have 4 line methods in php must be a nightmare.
Not really. I mean PHP does have a bad reputation, but it's possible to have nice, concise methods.
 
So because of a syntax error in a query, MS Access didn't allow me to open said query in the SQL editor to fix that error. Isn't this awesome?

I had to print the query via VBA, delete it and create it again. Of course it turned out that Access itself messed up the query.
 
Ugh, spent 2 hours on a bug that was caused by a single letter in a database table name have the wrong casing. Found it before my day was over though.

I mean, I did pretty much everything to debug this...set up the MS database profiler to catch the query and see the values, double checked the data dictionary, sifted over every line of code over and over.

1 fucking character...ugh.
 
Not sure if there are any other Computer Science students like myself in here but... I always read my assignment sheets for my current programming class and think to myself "Ah, that doesn't sound so bad."

Then it gets be a few days before the program is due and I start panicking after I sit down and try to code some of it because shit doesn't work like I thought it would.

I really need to start respecting the time given to us for these things instead of putting it off so much.

I think this is the case with every Computer Science student.
 
1 fucking character...ugh.

I know. It's the worst. I once spent 2 hours confused as to why my code wouldn't compile. I got strange problems all over the place. The errors were nonsense.

The problem?

// in someheader.h
Code:
k#ifndef SOMEHEADER_H
#def SOMEHEADER_H

/*
COPYRIGHT COPYRIGHT COPYRIGHT YEAR
Does this notice even mean anything?
Wait, I need the mailing address. Probably out of date.
*/

/* If you want to do stuff, use this!
*/
class SomeClass
{
public:
    void stuff();
};

#endif

Opps. Somebody hit a key with the wrong window active and added a single character right before the include guard. These were the days before we had a continuous integration server, so it was not caught immediately.

God damn, do I love Jenkins. Nightly builds are not even remotely close to enough.
 
God I hate Java sometimes.

Spent a few months migrating code from JBoss to Glassfish, updated Spring, Hibernate, etc. Everything working perfectly. First load test we get hundreds of transaction errors on what is functionally exactly the same code.

AAARGH.
 
Ugh, the bf's company just announced they're going to transition from Windows/.NET to Linux/Java.

I know language doesn't matter to a good programmer, but we're still gonna have preferences! It seems so hard to find MS shops around here :(
 
Ugh, the bf's company just announced they're going to transition from Windows/.NET to Linux/Java.

I know language doesn't matter to a good programmer, but we're still gonna have preferences! It seems so hard to find MS shops around here :(

I'm not so sure about that. Clearly, some languages and platforms are better than others for certain tasks, not to mention all that experience that's usually wasted from such transitions.

However, I'll admit that I'm a little biased after surviving 2 failed transitions. If you didn't know, there is a special place in hell for transitions without solid technical grounds and planing.
 
Ugh, the bf's company just announced they're going to transition from Windows/.NET to Linux/Java.

I know language doesn't matter to a good programmer, but we're still gonna have preferences! It seems so hard to find MS shops around here :(

The company I'm working for is going through the same transition. In fact, that's why there was an opening for me to apply for to begin with. They wanted two guys to start off the transition to help the existing team migrate over this year.

Of course, being an MS/.NET house they couldn't decide on whether/where PHP/Perl/Scala/Ruby/Python/SQL/NoSQL fit in the pipeline of things we needed to build for a few months. So, there's been a lot of faffing about, and I've spent a few months teaching myself a lot of new things, and arguing with the two other guys in our group about which direction to go, but not actually building the products we need.

Thankfully, things have finally started to shake out this past month, and we have tools, platforms, etc. in place now, so I'm slowly getting to work on the new products.

As a newb (professionally) to the field, it's been bewildering and frustrating at times. I can empathize with how hard it has to be for someone who's been working with the same language/environment for years.
 
Ugh, the bf's company just announced they're going to transition from Windows/.NET to Linux/Java.
I'm just bitter mono is a second class citizen, shadowed in uncertainty and doubt. C# has always felt to me like Java done better, and it pains me that its adoption is crippled by fear on non-Microsoft platforms. They shouldn't have had to switch languages.
 
Yeah, about that.. last week at work, I found a method with a length of about 550 lines. It's basically a huge if-elsif-elsif-etc tree full with redundancies. Just terrible.

Yeah, about that.. last week I found a single instruction which was nearly 100 lines. A call to a setter method, assigning an anonymous class with several methods, where some instructions in those methods contained other anonymous classes.

It's awkward. The people here are really bright, much better and more experienced programmers than I am. Our applications are big and complex. They are used all over the world and work pretty well. And yet, the code quality is really awful.
 
The situation has finally reached a breaking point at work, and I'm going to have to roll up my sleeves and fix/refactor all of this crappy code our fantastic* developers have written. Good news is we have successfully offloaded one of the worst offenders into another group - it's ridiculously hard to get rid of dead weight around here.
 
I hit a breaking point at work, too. I moved my desk out of the main programmer room in an attempt to decrease my frustration. It won't work for long.

I'm just bitter mono is a second class citizen, shadowed in uncertainty and doubt. C# has always felt to me like Java done better, and it pains me that its adoption is crippled by fear on non-Microsoft platforms. They shouldn't have had to switch languages.
Completely agree, 100%. Of all the languages to switch between, C# and Java are probably one of the easiest pairs. But it's pretty much without doubt that C# is far, far superior even if the runtime isn't as quick. I Could list 50 things that make C# such a joy to code in, in comparison.
 
Can RTL writers/verifiers also play in this thread?

For anyone aspiring to write System Verilog, be very VERY careful when dealing with

fork
do_stuff();
do_other_stuff();
join_none <- This guy right here

Make sure to document the heck outta your code when you do a fork join_none because debugging multithreaded system verilog code reliably is not a fun time.
 
I'm not so sure about that. Clearly, some languages and platforms are better than others for certain tasks, not to mention all that experience that's usually wasted from such transitions.

However, I'll admit that I'm a little biased after surviving 2 failed transitions. If you didn't know, there is a special place in hell for transitions without solid technical grounds and planing.

Yikes. Well, the bf's company is expecting the transition to happen over a manner of years, so hopefully it will be successful. Of course he hopes to be out of the programming game by then and into management.

But so much for me ever going over to that company! I'll stick to my public service job with complete autonomy, thank you very much.
 
I got assigned a code review for a change one of my coworkers made. He moved one line of code from one function to another. I told my team lead that I can't review the code because the class is such shit that I can't tell what is being done and when. He said he'd take care of it.

He came back 20 minutes later and said he doesn't want to try and understand the code because it's so poorly written. He said just to accept the change and move on, even though we can't understand it.

This crap has been going on for 2 years. One of my coworkers is such a bad coder that it's unbelievable. And yet the leads here don't give a shit. Nothing he writes works. You can tell from talking to him for only 2 minutes that he doesn't understand the first thing about programming. And yet they've kept him here all this time and keep assigning him work on important projects. I have to fix everything he does (ie: rewrite from scratch after hours) or hold his hand through the simplest tasks. The project we're wrapping up was supposed to take 6 months, but we're on month 14. We could have easily knocked it out in 6 months if this guy wasn't on it. He's actually a detriment on a project. We'd be better off paying him to twiddle his thumbs all day.

I talked to my boss saying how frustrated I am working with him, and that I won't do it anymore. He said he's aware how worthless the guy is, but he thinks the guy is pretty unhappy working here anyway so "the problem will probably solve itself eventually." I was flabbergasted.

My coworker has over 10 years experience, which he brings up on a regular basis when he thinks you might be suggesting he doesn't know something. I cannot understate how poor this guy's skills are. And they're completely fine with him running us into the ground instead of doing something about it. We're a small company (4 programmers and 2 hardware guys) so he has a significant impact.
 
I got assigned a code review for a change one of my coworkers made. He moved one line of code from one function to another. I told my team lead that I can't review the code because the class is such shit that I can't tell what is being done and when. He said he'd take care of it.

He came back 20 minutes later and said he doesn't want to try and understand the code because it's so poorly written. He said just to accept the change and move on, even though we can't understand it.

This crap has been going on for 2 years. One of my coworkers is such a bad coder that it's unbelievable. And yet the leads here don't give a shit. Nothing he writes works. You can tell from talking to him for only 2 minutes that he doesn't understand the first thing about programming. And yet they've kept him here all this time and keep assigning him work on important projects. I have to fix everything he does (ie: rewrite from scratch after hours) or hold his hand through the simplest tasks. The project we're wrapping up was supposed to take 6 months, but we're on month 14. We could have easily knocked it out in 6 months if this guy wasn't on it. He's actually a detriment on a project. We'd be better off paying him to twiddle his thumbs all day.

I talked to my boss saying how frustrated I am working with him, and that I won't do it anymore. He said he's aware how worthless the guy is, but he thinks the guy is pretty unhappy working here anyway so "the problem will probably solve itself eventually." I was flabbergasted.

My coworker has over 10 years experience, which he brings up on a regular basis when he thinks you might be suggesting he doesn't know something. I cannot understate how poor this guy's skills are. And they're completely fine with him running us into the ground instead of doing something about it. We're a small company (4 programmers and 2 hardware guys) so he has a significant impact.

Interesting, sounds like you're stuck between a rock and a hard place.

I've always wondered how people with no programming skill even get programming jobs. I mean, you always hear about companies presenting extremely tough programming and logic questions in interviews, stumping even the smartest of people.

How do people like this slip through the cracks?
 
Interesting, sounds like you're stuck between a rock and a hard place.

I've always wondered how people with no programming skill even get programming jobs. I mean, you always hear about companies presenting extremely tough programming and logic questions in interviews, stumping even the smartest of people.

How do people like this slip through the cracks?
Being friends with people in the company.

A lot of companies are poor at hiring. Hiring is not easy, especially if you don't have somebody that does it full or part time. This particular employee got hired based on the word of somebody else here, and that he had years of experience. They didn't ask him a single technical question during the interview. If they had, it would have been immediately obvious.
 
I've always wondered how people with no programming skill even get programming jobs. I mean, you always hear about companies presenting extremely tough programming and logic questions in interviews, stumping even the smartest of people.

How do people like this slip through the cracks?

They get jobs at places that don't ask those questions.

The only programming-related task that came up for my current job was a take-home assignment to make a shitty web page that queried a database. The questions I got were simply personality/past experiences questions.
 
Being friends with people in the company.

Ugh.

They get jobs at places that don't ask those questions.

The only programming-related task that came up for my current job was a take-home assignment to make a shitty web page that queried a database. The questions I got were simply personality/past experiences questions.

Woah, that's it? What job is it anyway, if you don't mind my asking?
 
So, this Access file I refactored last year... two months ago some user called me because a few records were missing. I was pretty nervous because I thought I had fucked something up. User aren't supposed to delete any records, and I doubted any of them had the skills to find out how they could do it.
I couldn't find any errors. The records were in the last backup, but now they were gone. Shit.

I got another call last week - again, some record were missing. Maybe this was no error but someone overwrote the record IDs? They contain country information about the records (not my design). So maybe someone assigned the records to another country and also changed the IDs?
I tried to find similar records. For each record, there's a field with the username who last modified it. I called all of them and asked if they modified country data or noticed any warnings or errors.
Nothing.

Then I found another trace leading me to the user who actually notified me about the missing data. She's one of the main users and has been working with the file since a long time, so no way she could have overlooked a problem. Nevertheless, I send my standard "did you notice anything" email, and she offered to start a screensharing session to show me how she's working with the file.

I didn't expect this to help me in any way, but I agreed.

Before I conclude, I need to explain the interface: It's a simple master-detail view. The top half of the window is the list of records, the bottom half is a form showing the details of the selected record. They're separated by a toolbar with some buttons to add records, to save/undo changes in the detail form and a few more.

So, the user opened the file, wanted to add a new record.. and did not click the prominent "Add new record" button, but started editing in the detail view right away. When the file is opened, of course the first record is selected. She changed the data, including the ID, and saved it. I was speechless.

Fucking hell. Motherfucking hell. She never knew about the "Add" button. For more than a year, she had been overwriting existing records instead of adding new ones. To think about how much data is gone.. wow.

Overlooking the button, yeah, I could understand that, maybe. But what the fuck was she thinking when the text fields were already filled with data and she simply deleted the content or overwrote it?? Some people...
 
So, this Access file I refactored last year... two months ago some user called me because a few records were missing. I was pretty nervous because I thought I had fucked something up. User aren't supposed to delete any records, and I doubted any of them had the skills to find out how they could do it.
I couldn't find any errors. The records were in the last backup, but now they were gone. Shit.

I got another call last week - again, some record were missing. Maybe this was no error but someone overwrote the record IDs? They contain country information about the records (not my design). So maybe someone assigned the records to another country and also changed the IDs?
I tried to find similar records. For each record, there's a field with the username who last modified it. I called all of them and asked if they modified country data or noticed any warnings or errors.
Nothing.

Then I found another trace leading me to the user who actually notified me about the missing data. She's one of the main users and has been working with the file since a long time, so no way she could have overlooked a problem. Nevertheless, I send my standard "did you notice anything" email, and she offered to start a screensharing session to show me how she's working with the file.

I didn't expect this to help me in any way, but I agreed.

Before I conclude, I need to explain the interface: It's a simple master-detail view. The top half of the window is the list of records, the bottom half is a form showing the details of the selected record. They're separated by a toolbar with some buttons to add records, to save/undo changes in the detail form and a few more.

So, the user opened the file, wanted to add a new record.. and did not click the prominent "Add new record" button, but started editing in the detail view right away. When the file is opened, of course the first record is selected. She changed the data, including the ID, and saved it. I was speechless.

Fucking hell. Motherfucking hell. She never knew about the "Add" button. For more than a year, she had been overwriting existing records instead of adding new ones. To think about how much data is gone.. wow.

Overlooking the button, yeah, I could understand that, maybe. But what the fuck was she thinking when the text fields were already filled with data and she simply deleted the content or overwrote it?? Some people...
Wow, haha. When you save, I hope it pops up a message that says "Are you sure you want to overwrite/change this record?" or something like that. And the save button better be labeled something that makes it clear you're not creating a new record, but editing one.

Can't always blame the user!
 
When the file is opened, of course the first record is selected.
I honestly think this is part of the problem. It's not an obvious consequence, but your software is implicitly telling the user "Hey, I think you want to work with this" when they really don't. What are the odds that the user cares about the first record? There should be no selection on initialization.

It's such a tiny little detail, but it might have made a world of a difference. If the user had to specifically choose which record to overwrite, I bet they wouldn't have done it.
 
Status
Not open for further replies.
Top Bottom