Lurker News
Recently I joined a relatively small company (50-100 employees) as a medium level software developer. For a while I was very excited about this opportunity.

After few days/weeks of getting to know the whole codebase I finally moved to a specific project I was suppose to work on and I found out the code is a complete mess. Often I find parts of code that unintentionally affects other parts of code. Some parts are just copied and left there doing nothing. Even names of classes/variables are sometimes useless and project structure is unintuitive and seemingly without rules. It's spaghetti and relatively big spaghetti (tens of thousands of LOC).
I started "repairing" the project but there're no tests to check whether my adjustments are correct.

I'm so frustrated and depressed by it. The job basically turned into something I hate - I'm just rewriting the code! The person in charge of this project was working on it alone and from the outside it all looks fine and it's working. So this makes the higher people think that it's all just fine. I really don't know what to do. Should I just go and basically say that this person did a bad job? I don't feel very comfortably doing that because (a) I'm a relatively new hire, (b) the person in charge is working there for about two years and (c) I'm much younger than she/he is both professionally and biologically.
I've already made some comments about rewriting it and the response was basically "ok".

Comments (333) 173 threads

Show all comments

Showing thread 158 of 173

dstjean2 replies#
Are there tons of global variables?
throwawa1238#
How about returning a reference to a static variable that changes when the function is called with different parameters. [C++]

I can't imagine why he thought that was a good idea.

seabird1 reply#
I recently rewrote a flashing tool that was used for programming engineering samples (which there is an extremely limited supply of) and production equipment.

Literally everything (and I mean everything) in the old implementation was a global variable that would just be recycled throughout the runtime of the program. Excluding loop counters, you could count the number of localized variables on two hands. The call-and-response serial communication implementation was a pseudo-state machine scattered across a shitload of global variables, and it ran entirely in the UI thread. When variables didn't have useless names, they would often have the same name as another variable, just with the capitalization changed.
Software development is hell.

zwirbl#
At my work it's a few hundred globals, often times used in a few hundred different places scattered over, again, hundreds of files.

To make things more fun there rarely is a function with less than a 1000 LOC, written in a Winforms Button_Click handler. Less than 10 functions I've seen take parameters and return a value, almost all rely on globals being set and set some themselves in return.
After the manager and main author of the software asked me to build a new UI and leave the underlying code untouched I decided to leave the company and work on someone elses messy code