views:

761

answers:

13

I wanted to get some of your opinions on this issue. I am getting frustrated at the programs I am supposed to work with at my workplace. I am working as a junior software developer in a small company. A lot of times I need to "re-develop" apps - upgrade them. and so I need to understand what the apps currently do, migrate databases and such.

So my recent assignment, the old one not done by me:

The database for the reports has columns named e01 through e10 and in each cell (this is using access) has data like:

Achieved[-[|]-]Achieved[-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-][-[|]-

Ok, I know it's some kind of delimited data but how do I know what each value represents? There is no documentation so I read code, and I feel this is stupid. I waste so much time and end up with nothing much. Its working with very badly developed code/db.

BTW, by the number of columns (10) * number of delimiters you can count how many fields I need to create this report right. That's very tedious.

What will you do? Quit and get a job that has better quality software/clients seems a good choice? I mean, reverse engineering such an app seems like a waste of time. I rather learn to reverse engineer windows 7! Make it less bloated.

A: 

Find another job where you have more opportunity to learn proper things. Meanwhile, since you are here and since you are re-developing the app, you can help your existing company by creating some better designed software so that the one succeeding you doesn't end up doing the same things.

Aamir
to do that (do a new version myself) i need to waste time figuring out how the bad code works ... but maybe it will be good (not good actually) "reverse engineering" experience ...
iceangel89
Same like ammoQ. I think you dont know enough about him to give such an advice.
Martin K.
+2  A: 

Stay there for several months, so you learn a very important thing: Why bad code hurts so much. Then get out and work in a company that at least tries to develop decent software. If you stay there too long, you will adopt bad habits.

ammoQ
i actually dunno staying will be good idea ... but i am part time now actually, waiting for national service ... hopes i wont waste time inside ns ...
iceangel89
I think you don't know enough to give such an advice. Adopting bad habits is kind of the personality. A lot of people will increase the quality without adopting bad habbits and leaving a company.
Martin K.
Martin: I don't think you know me enough to judge my knowledge ;-)
ammoQ
I judge only your knowledge about iceangel89, not about your skill.He has written only one question and you tell him to quit his job? mhh?Chill out!
Martin K.
Martin: In my experience, if a junior programmer starts withing a bad environment, chances are he will not be able to change the environment, but rather change himself. For example, the code smells a lot. What to do? Refactoring! Unfortunately, to make refactoring safe, you need unit test. Unfortunately, for unit tests, you need testable units. But how to break down the large spagetti code into testable units? By refactoring! Ooops... Improvement on a large scale is, unfortunately, unlikely to happen, especially when the "newbie" is the only one who recognizes the need.
ammoQ
Martin: BTW: Quitting the job is one of the options the original poster mentioned, so it's IMO appropriate to say "Do it" when I think so.
ammoQ
+12  A: 

The bad news is that you're almost always going to find poor levels of coding. Sometimes you may have to look hard. Sometimes not!

The good news is that it's an opportunity to learn and implement better mechanisms. It will hone your analysis and debugging skills. It's important to make sure that people (management?) know that you're having to work with poor code, and that you're doing something to improve the situation.

The best scenario is that you gradually change your environment, and become a better and respected software engineer. The worst scenario is that people keep generating poor quality code for you to re-engineer, in which case your new skills will be useful in finding new employment.

Brian Agnew
+1 for "almost always". This is a problem that you'll find throughout your career unless you get a job at google or fogcreek or something. So it's important to learn how to deal with it.
annakata
+1 for "It's important to make sure that people (management?) know ..." rediscover communication.
Martin K.
to @annakata, I think it's probably more likely 'always' and even fogcreek, google, and the like have enough bad code. Most of us if we're honest, would look at our 5+ year old code and think it's bad too. Sometimes the pressure of time does this whether it's our fault or not.
kenny
@kenny: i agree with "Sometimes the pressure of time does this whether it's our fault or not" because of time sometimes i myself also code badly ... but as a consolation not as bad ...
iceangel89
@Kenny - yeah I was just charitably assuming this happens *less* at google-esque shops, though I certainly find my 5 year old code painfully embarrassing :P
annakata
@annakata LOL ... lets work for a better future ... better code ... quite a noble comment LOL
iceangel89
-1 for forgetting to mention that while bad code may be common, not every job is swimming in stuff as bad as this. As a newish programmer, iceangel is trying to get a feel, from more experienced guys, for how bad this is compared to any other job. I think this code is a quite a bit worse than average. Have any of you really ever produced anything so bad - even when you first started? Did you, years later when you knew better, ask a junior to maintain something like this?
MGOwen
+4  A: 

Welcome to the real world! I'm afraid that this will most likely be the case at most jobs. Every work place will have 'bad' code without documentation and the only way to figure out will be to analyze the code itself. If you are lucky someone else will know how it works. Like other people say see it as a lesson of how important it is to document what you do and once you have figured out how something works you should document it. That is time well spent instead of whining how 'bad' everyone else is. It might not be fun, but this is work and you are paid to do it.

willcodejavaforfood
Maybe this should be termed "Red Pill" software?
Skizz
Yeah, thats the dammit real world!
Martin K.
"I'm afraid that this will most likely be the case at most jobs" i seem to feel that's quite true now ... i quite agree to take it as a lesson ... thats the ... positive way to think
iceangel89
Yeah, it's the sad truth. I would even expand on it. Often if there is documentation, you can't count on it since the code was changed without updating the docs. Reading old code is a necessary skill. Work is a four letter word.
kenny
+11  A: 

Read Joel's Getting Things Done When You're Only a Grunt article and start working on doing the best you can on your job. If you can teach yourself how to learn, even in the worst of situations, that's a skill that will come in handy for the rest of your life.

David Schmitt
+5  A: 

At first! Communicate much more! Thats the key to so much more fun, less frustration and more compliment! Tell the people around you from your pain, maybe they can help you. Tell your line manager / boss about your problems and how you feel with this.

If they don't know about your pain, they can't help you. That is what every boss need, information.

" there is no docs so i read code "

Tell it to your project manager! Maybe he knows who can help you or who has written this piece of software.

quit and get a job that has better quality software/clients seems a good choice?

Wow! If you already think about this, you don't seem to have much fun with your job. If you're pissed of, think about it. But everywhere you go, you'll see bad pieces of software which need refactoring or reengineering. My opinion: You have the chance to increase the quality of a piece of software! Use it. If your project manager will prevent you from doing the right thing (refactoring, increase quality/reliability...), say him clearly what you think about it. Quitting should be only the last instance of what you do.

i mean, reverse engineering such an app seems like a waste of time

Tell it to your project manager! He has to care about your problems. He should make you feel right ;) To identify project risks is his job! Tell him you need more functional input. Talk about maintenance charges! Ask for a big refactoring of the whole application or parts of it (Middleware to hide the shit in the backend).

i rather learn to reverse engineer windows 7! make it less bloated

Huh! Try it ;) I think you don't have a chance to.

Have a look at "Run length encoding" if you want to compress this fluff: [-[|]-][-[|]-][-[|]-]

http://en.wikipedia.org/wiki/Run-length_encoding

Martin K.
haha i know reverse engineering windows 7 is not quite possible, i dont even have the source. i dont have a project manager ... its a small company ... i am the only developer ...
iceangel89
Then tell everything to you boss / line manager. If you don't have one, ask for one or use the chance to get the position ;)
Martin K.
aha i like "get the position" but ... i sometimes i feel i am not really the leader kind
iceangel89
@iceangel89 - You're the only developer? Don't you realise what a chance this gives you? In RL you'll find that all companies have bad, legacy code that they must use and for commercial reasons can't rewrite from scratch. The only companies that have truelly documented code tend to be aerospace or defence, rarely commercial.Opportunites are created, rarely given, and will require hard work. Turn this to your advantage.
ChrisBD
@ChrisBD i know being the only developer i do the code as i like, the only thing i dont like is having to work with bad code ... it wastes alot of time ... i feel i can make better use of that time
iceangel89
Yes exactly, but coding improvements are never a waste of time. Quietly try and push through standards of your own; show that unit testing means more stable and bug free software, use it to verify that your coding improvements don't change code behaviour. Look at this as a learning experience, how not to code, how to improve it and prove that it still works.Don't think that you have to tackle all of it. Pick small sections of functionality that can be easily decoupled, improved and tested.
ChrisBD
ChrisBD is so right! Take your chance! Refactor "bad code"/"code smells" to "pretty code" ;)Take care of standards, best practices, refactoring patterns, abstraction and modularisation. You don't need to rewrite a lot of code, if you can hide the smells beind a facade/interface etc. Take a look at these concepts! Your main goals should be easy software maintenance, decoupling, readable expressive code and a really good software design. Feel free to ask questions on stackoverflow ;)
Martin K.
+1  A: 

A lot of the jobs you are going to find would be like this.

Advice to you would be try finding a new job at somewhere they are doing something bleeding edge, like a startup.

For your current problems, make it easier for yourself by creating the stuff that would eventually make life easier. Like creating the mapping from e1 to e10, etc. Do this once and don't tell your boss that you did, this would mean you have loads of time that you could use in learning new stuff whilst the boss expects you to take a long time because of the poor code.

Neoryder
"Do this once and don't tell your boss" u mean when my boss knows i am working on poor code and i try to create a mapping?
iceangel89
what I mean is you create your shortcuts to help you work faster but don't tell the person who makes the estimates. This would effectively give you time to do your own thing/study the stuff that interests you.For example: I have this maintenance work on an old project that is very tedious because I have to click a lot of times in a browser.I installed firebug and created a script that meant saving around 5-40 minutes per task of this type. This meant I had more time to use in studying stuff/coding stuff.
Neoryder
I think thats a bad way of project escalation which can cause pain at any involved person.
Martin K.
bad for the "boss" but good for me to have the opportunity to learn something more meaningful ... i actually like that ... not a very good way but thats real life
iceangel89
+2  A: 

Work on projects with other programmers. Be the best programmer on some projects; be the worst on some others. When you're the best, you get to test your abilities to lead a project, and to inspire others with your vision. When you're the worst, you learn what the masters do, and you learn what they don't like to do (because they make you do it for them).

source : http://norvig.com/21-days.html

Surya
+1 for "you get to test your abilities to lead a project,"
Martin K.
+2  A: 

don't expect that by running(changing job) you will get to better code, unless you are lucky. I have seen DB code of some major local retailers and it was funny. Lucky it worked properly - but it was huge mess.

haha thats real life i guess? LOL ... maybe unless i work at microsoft or google ...
iceangel89
+1 for don't expect that by running(changing job) you will get to better code,
Martin K.
are u all working with poor code? if most ppl are doing that and know that, noone fixes it?
iceangel89
there is often no budget or time for fixing. So you have to work with poor code. A lot of people chosse cheap developers, because they fulfil the functional requirements and they fit in into the project budget. Expensive developers are much harder to handle (ask more questions etc.). A few time later you as a developer have to deal with the software. Money was already spend there, so nobody want to throw investions away. Your chance: Refactoring etc.
Martin K.
time ... very important ... sometime i know that i shld fix something but because of time i leave it out ... haha i guess i myself is not such a good example ... but i try to plan well so at least i have a good starting point
iceangel89
+1  A: 

Code looks like BrainFuck... To be honest, I have over 20 years of engineering experience and this doesn't look that bad. It seems some kind of delimited data with [-[|]-] as delimiter. I guess there might even be some data between the [] parts of those delimiter and it might be some kind of multi-level data structure. With this kind of code and data, you'd better ask someone else in the company to explain to you what it means. If no one knows then you can try to find out yourself or just talk to your manager and ask them what it is supposed to do and rewrite the whole thing from scratch.

Don't give up your job simply because you can't understand it. Consider this a mighty challenge and try to solve it, asking as much help as you need to do your job. Whatever you do, provide plenty of feedback to your manager about the things you can't solve. As you say, you're a junior so you still need to build your experience. It is expected that you ask plenty of questions to get your job done right.

Basically, software development is almost always teamwork. Make good use of the whole team!

Workshop Alex
btw i am supposed to rewrite the program, kind of like upgrade it. thats whats in the database btw. +1 for the encouragement :) thanks all that answered/commented here also i appreciate it
iceangel89
Just ignore the contents of the database if you have to rewrite it. If no one can tell you how it's supposed to be used, it's not important. ;-)I found out that by just ignoring data like this, the users would soon start to complain about missing functionality and then they will tell you what you need to add again. If they don't miss it, then don't bother about it.
Workshop Alex
they will know through lost data?
iceangel89
Hey, if they don't notice that they've lost data, they never needed it to begin with! :-)Have recreated many projects from scratch myself, just to have users tell me afterwards what was still missing. Which was a lot less than what I would have had to implement if I did my best to keep all that data.
Workshop Alex
A: 

i am considering changing picking up 3D Modelling, Texturing, Rendering and such as an alternative career path, possibly game development/design, will that be a good idea? i guess at least in 3D there wont be any bad code ... except maybe in the 3D scripting side ...

but just considering, as an alternative ... IT/Programming is what i seem to do quite well - the dislike for all this bad code stuff

iceangel89
Actually, I have some experience with 3D modelling. I picked up this skill trying to create my own images to make my applications to look better. But in 3D land, the troubles are just as bad as in programming land, with many different formats and tools, lack of standardization and in general too many amateurs polluting the code base. Sometimes, creating 3D models are worse than programming since it takes a lot more time to get a good result.
Workshop Alex
+1  A: 
  1. It takes a good programmer to fix bad code
  2. Fixing bad code is good experience and can make you a really good programmer

There's this junior programmer out here who has given his seniors quite a complex by unflinchingly taking up the most hopeless code and fixing it a little bit each day. This is code we had given up on and it works fine now.

Of course, we all have our limits. :)

Vulcan Eager
+3  A: 

My first job coding was at a place that seemed pretty modern -- huge corporation, working on a Web app in .net/C# with SQL Server behind it. Three-level architecture (presentation, mid-tier, data access), all sound design principles.

Then I got to the code. Total mess -- javascript everywhere doing nothing, 1100 instances of Catch ex As Exception, race conditions everywhere. You could make an innocuous change and find it broke six other things because the code was depending on the execution path you were on to take less than, say, three seconds, and if it took four, the whole page blew up trying to access an element that wasn't there, or thereabouts. It was nearly impossible to change anything without some kind of side effect. Come to find out I was a new developer on a project that had recently been brought back in house from outsourced development in India. And of course, the outsourcing shop was essentially told, "make it work, we don't care how".

Tell you what though -- learning what exactly was hosing a lot of that code up taught me a lot about best practices. Learn what practices to follow by observing the mistakes and issues that result by kludging things together. You may not want to stay there long, and it may be agonizing, but you will gain valuable insight from the experience. And if you can manage to rework all the crap code into good code, there's a possibility you might profit from it. If not, take the lessons you learn and allow a half-decent employer to reap the rewards.

Jim Dagg