views:

989

answers:

14

I am currently doing some contract work for a company. Now they want to hire me for real. I have been reading on SO about code smells lately.

The thing is, I have worked with some of their code and it smells. Badly. They use incredibly old versions of MSVC (2003), they do not seem to use version control systems, most code is completely undocumented, variable names with more than three letters are a rarity, there is commented out code all over the place, some methods take huge amounts of arguments, UI design is seemingly done by blind people... Yet they seem to be quite successful with what they do and their actual algorithms seem to be pretty sound and rather sophisticated. Since they mostly do DSP stuff, I am willing to ignore the UI side of things, but really these code smells are worrying.

What would you think of a company that doesn't seem to value readable code? The people are nice enough and payment would be good. How much would you value code smells in this context?

You see, this is my first job and SO got me worried, so I turn to you for suggestions ;-)

Edit: The MSVC 2003 thing turned out to be an overlooked requirement of the installer only. They are actually using MSVC 2005.

+24  A: 

Code smells themselves aren't really the problem, it's whether the company listens when someone says it should be fixed that matters.

thecoop
+1, Agreed. But - for the sake of applicability - a company with this many code smells sounds like a company that doesn't listen.
JMTyler
+6  A: 

Submit them to the Joel Test, see their score, try to find something better if possible :)

Supplemental:

As a rule, code smells are not problems so much as they are symptoms. Try and find the source of the disease.

MPelletier
Make sure you share the results with them and show them where they can improve.
Bill the Lizard
Make sure you have another job well in your sights before you attempt what Bill said. Their M.O. will be : *does it print money? If so, continue.*
MPelletier
+1 for describing code smells as symptoms. That's exactly it.
JMTyler
JMTyler: Thanks. As the son of two health workers and the designer of a hardware diagnostic system, it feels natural to use the analogy. "A fever is not a disease, it's a symptom."
MPelletier
+2  A: 

Well... You state clearly (though not explicitly) that you don't like many things there. Which implies you will not enjoy working there.

sharptooth
+5  A: 

People are nice and payment is good. You have the chance of making a contribution, and it looks like a successful company. I've seen many very sophisticated but messy code, and you can tell them that you can help them in this area - that will give you a chance to learn their stuff and make things better for the company.

Otávio Décio
As a matter of fact, I already am helping them on one project.
BastiBechtold
So, there you go. There is no perfect company. If you don't see resistence from them to refactor their code, then there should be no problem. Since you are already working with them, it wouldn't be too hard to imagine being a permanent employee.
Otávio Décio
+1; No code stands alone and if their algorithms are sophisticated it sounds like the rest was cobbled together to focus on the 'important stuff'; this could be a great opportunity for you to round out their development efforts to produce a complete and elegant deliverable.
fbrereto
+9  A: 

If this is your first software job, it will be hard for you to know. It took me a while to get a feel for what a good software company is (by my personal standards). If you are already working there then you've got a huge advantage though. Can you put up with everything you just mentioned? Does the team seem open to change and suggestions? If you could show them a compelling reason to say, use source control (wouldn't be hard), would they be open to it? If not, I'd certainly turn away. Otherwise, it's not necessarily bad.

No company is going to be perfect, it's more their attitude and how they adapt to their flaws that is often more important IMO.

Matt Greer
They definitely listen to criticism and are willing to help out with any questions or suggestions.
BastiBechtold
Besides, if you come in and clean things up and improve things dramatically, you're going to be the one to move up :)
Matt Greer
+1 - Attitude and openness to improvement is the key here. As said, no company is perfect, it's the ones that recognize this and are actively trying to improve where you will find contentment and happiness.
CraigTP
+1  A: 

What will be your position?

Will you have the opportunity to do something about it, thus proving your worth to the company? Or will you work with a pointy haired boss who doesn't know and doesn't care about the software?

Stephen
Yes, I would be doing (am doing) something about it. I am working on one a newer implementation of one of their products.
BastiBechtold
@Paperflyer, that is a "code smell" in of itself. It is almost always better to refactor that redesign:http://blog.objectmentor.com/articles/2009/01/09/the-big-redesign-in-the-sky
Gord
@Gord, no, actually I am porting it to a new platform.
BastiBechtold
+2  A: 

Welcome to the real world. If nothing else, working on a messy project is a good learning experience and to be honest, not something you will be able to avoid. If the work is interesting, the people OK, and the pay good, take it. If it becomes too frustrating, find something else later.

It's like a journalist... they might want a job covering celebrity weddings or presidential elections, but they mostly have to take a job writing about dancing dogs or local spelling bees.

John
+1  A: 

If their code was good, they wouldn't need any help.
A massive oversimplification perhaps, but you're obviously far more likely to find employment at a place where improvement is necessary.
More often than not, a new job means a new pile of software problems to tackle. That's what the job is.

What I've found to be really important is the people you'll be working with.
Are they dedicated professionals? Jump on that job offer, they'll be great to work with and you'll be able to improve the codebase a little every day.
Are they cowboys and hackers? Run away as fast as you can, they'll reject all proposed improvements and therefore it'll only get worse.

HTH!

Task
No, they are definitely professionals. I guess many of the code smells actually originate from their DSP stuff, where performance and optimization is paramount.
BastiBechtold
Then I'd say that there's a good chance then that what looks like a huge mess is actually an evolved system. Sometimes it's a big mess because that's what does the job best: http://www.joelonsoftware.com/articles/fog0000000069.html
Task
There's nothing "evolved" about not using revision control. I'm shocked that professional engineers would be so sloppy. Or, rather, I would be had I not spent most of my high tech career working with professional engineers and seen how sloppily they treated code. (Engineer boss on software: "It's just typing, isn't it?")
JUST MY correct OPINION
The code itself and how the code is managed are two separate things. Implementing version control would be the first change I'd want to make in there. If they're professionals that just don't know how to manage a codebase, they'll jump all over the idea and that problem will be solved. Anyone can write code, it takes a serious and capable developer to manage the full SDLC correctly.
Task
+15  A: 

Nice people and good pay vs. bad code formatting and structuring?

Think of it this way -- at another job you have a great codebase but the people suck. You can change the code formatting and structuring, but you can't change the people.

Get in there, get some experience in real world developing with people who it sounds like, while lacking in theory, know how to get things done.

Always keep in mind that the end user doesn't care what your code looks like. Not even a little.

Matt Dawdy
I would like to upvote this more. And if I don't like it, I can still look for a different job.
BastiBechtold
Exactly, Paperflyer. Just because you take a job doesn't mean you are stuck in that situation for life. My suggestion having been in a similar situation in the past -- don't expect rapid change. Work at it slowly, and always be able to justify your suggestions.
Matt Dawdy
@Matt: There's an important gotcha with your last paragraph. The end user doesn't care about the code, but the end user cares about a lot of other things that relate to code quality, such as reliability, how long to get a fix or new feature, things like that. Software engineering is not a theory on how to make pretty code, it's a theory on how to make reliable and modifiable code fast. No drivers cared about the details of the gusset plates on the I-35W bridge in Minneapolis until the bridge fell down during rush hour.
David Thornley
Great point David. I debated mentioning most of those points in my original post, but didn't want to water it down too much. Bad code is much harder to alter to bring in new features, and, if truly bad, then does hide bugs. I'm on a project right now where a previous programmer tried to match up a cost with an account, and instead of throwing an error if one wasn't found they decided to let it fail silently. 3 months into production, and what do you know, we've shipped out $50,000 that wasn't paid for. That's a huge loss, all due to bad coding conventions.
Matt Dawdy
Also important: people expect you to implement features and fix bugs. If you do that quickly and capably, they'll appreciate you a lot. Having code that's a terrible headache - even if it's widely acknowledged to be a problem, but particularly if it's an unrecognized problem - *will* slow you down and cause you to make more mistakes. That will reflect poorly on you. This doesn't have to be a big problem, as long as it's dealt with eventually, but it's something to be aware of.
Eamon Nerbonne
+1  A: 

When I worked in telecoms, what you described was rather common with small companies. The engineers were experts in protocols and DSP, but they did not have a software engineering background. They were not experts in software architecture, design patterns and all the latest fads in testing, but they produced solid products which the customers demanded. At the end of the day, that is really what matters.

Still using VS2003? So? Does it cause any bugs or introduce any problems that would be resolved by upgrading? Would it be worth the time spent trying to fix projects that are not imported and converted correctly by Visual Studio? Would it be worth the time to go back and fix problems introduced by switching compilers and run-time libraries?

No source control? A perfect chance for your to step up and show them the advantages of source control! I introduced SVN to a small company once and they were pleasantly surprised and really took to it. Be careful though, you may get yourself stuck with some boring work. I got stuck administering the repositories (backups, etc.) and access control...

No documentation? Sadly, this is very common everywhere. I'd love to see some statistics on this phenomenon.

Three-letter variables - sounds like you're working with electrical engineers!

Seriously though, its your first job and if the company is in good shape with good products, then get on board for the experience.

Dr. Watson
Actually, I _am_ working with electrical engineers ;-)
BastiBechtold
re: 3-letter variables: yeah, probably EE's. Unix hackers would use 1 character variables.
Hugh Brackett
+3  A: 

The lack of a version control system would worry me the most. Some time ago I adopted "What system do you use for source code control?" as a standard interview question (when asking questions about the company). Consider it to be something of a reverse fizzbuzz, something to find the truly unprofessional.

A company without version control in 2010 suggests to me one that is unable or unwilling to adopt good development practices, and the one time recently (i.e., since 1995) I was in that position I was intensely uncomfortable with the company.

Before accepting, I'd recommend talking with people in the company and seeing how interested they'd be in upgrading their development environment. Since you've been contracting, you may know some of your future co-workers well enough to judge their honesty. (I've been lied to before about what the company intended to do, so I no longer trust hiring managers's statements.)

David Thornley
It's a small company. I know all of the employees since I actually did my Bachelors work there. I think I can trust them.
BastiBechtold
@Paperflyer: Excellent. Then you can get straight answers you can trust.
David Thornley
+3  A: 

When I started reading your description, I was thinking "You probably work for scientists, not software people" and then you mentioned it is DSP, which basically confirmed my assumptions. You need to understand what you are getting yourself into. They will never write code "professionally", and that's fine for them. Nothing you do will change that culture. You should join this company only if the following are true:

  1. If you are disciplined enough to write your own code in a professional way
  2. You are ok with other people producing slop code and dealing with it
  3. You are more interested in increasing your domain knowledge than growing as a software engineer (which is A-OK. Growing as a software engineer requires working with other software engineers.)
frankc
Actually, I am an Engineer myself but kind of turned towards software development at some point.
BastiBechtold
+1  A: 

Three sources of more real-life horror stories are the RISKS digest (aka comp.risks) moderated by Peter G. Neumann, and The Daily WTF web site which is less serious but still explores the real world experiences of software developers and IT professionals.

Finally the writings of Robert L. Glass, including some of his books such as Software Runaways, Facts and Fallacies of Software Engineering, Computing Calamities, Software Folklore, and Universal Elixir and Other Computing Projects Which Failed amongst others.

I think the answer comes down to the employer's attitude, and the willingness to improve. So a lot of it depends on your manager or senior developer if they have the final say about the source code. As Dr. Watson suggests, the source code may of been written largely or in part by engineers, who typically are exposed to Fortran (often Fortran-77) at school, and still follow antiquated restrictions and are not use or perhaps even aware of best practices of software engineering / development.

For a thought experiment, imagine yourself as Chef Gordon Ramsey stepping into a failing restaurant run by this employer, as his UK and US television show Kitchen Nightmares. Would this employer being willing to adapt to a more successful format to help themselves.

As far as passing a huge number of parameters, suggest that using structs and passing a single pointer pushes less data onto the calling stack so would be more efficient particularly if the function(s) is/are called often. (I'm suggesting that from a C rather than C++ point of view)

Because of the performance critical orientation of the code, using standard OOP techniques might be tricky to implement without a performance penalty, so besides introducing source control (and associated backups, a bug database, easy-to-use test cases from reported bugs, and a build system), a benchmarking / performance evaluation scaffolding might be another useful tool they might make good use of, so you can quickly make performance evaluations of potential code improvements.

As far as UI, one approach would be to suggest office copies of common UI and usability references, such as from Joel Spolsky, Alan Cooper, Steve Krug, Jef Raskin, and Jakob Nielsen.

mctylr
+1  A: 

Look on the bright side - at least you wont be scared to touch the codebase because you might not live up to high expectations :)

I guess the decision is whether you enjoy taking some messy code and cleaning it up?

rtpHarry