Author Topic: Have you turned down work because of quality of source code  (Read 1610 times)

0 Members and 1 Guest are viewing this topic.

Offline snarkysparky

  • Regular Contributor
  • *
  • Posts: 189
  • Country: us
Have you turned down work because of quality of source code
« on: April 27, 2020, 05:44:43 pm »
I'm in a position where I may get the opportunity to go full time to work on a software project but the code base I will have to work with
gives me nightmares.   Haven't had to change it yet because we don't have a compile system but I have had to spend significant time trying
to reverse engineer what the code is doing.   That said some comments about this code.

It's a flat structure with many thousands of random functions just seeming to magically work together somehow.  No hierarchy of control.
Full to the brim with magic numbers in the source code.
Using VxWorks RTOS but nothing in interface is documented.
Virtually no comments.  Authors were Japanese and English comments were attempted but still not usable.
Variable and function names like Phtack2zu .... etc are the rule.  Very few names provide any context.
Vast amounts of abandoned code but not defined out or commented out ,  just not called.

source is C
Size is about 350 files.

I am tempted to reject the job cause I just don't think I can ever make sense of this mess.

Have you plowed through something like this or have you ever declined to work on it.











 

Offline snarkysparky

  • Regular Contributor
  • *
  • Posts: 189
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #1 on: April 27, 2020, 06:25:28 pm »
for example

Code: [Select]

SLONG kysChgAscdt( bind, strp, strlen )
ULONG bind;
SBYTE *strp;
SLONG strlen;
{
UBYTE ascd;
SLONG i;

kysPadSet( strp,strlen,' ' );
strp = strp + (strlen-1);
for( i=0 ; i<strlen ; i++ )
{
if( bind == 0 )
{
if( i==0 )
{
*strp = '0';
i=1;
}
break;
}
ascd = bind % 10;
ascd |= '0';
*strp = ascd;
--strp;
bind = bind / 10;
}
return( i );
}



 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #2 on: April 27, 2020, 06:27:41 pm »
No comments, but the identifiers for functions and variables don't even help either! :-DD
 
The following users thanked this post: snarkysparky

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: de
Re: Have you turned down work because of quality of source code
« Reply #3 on: April 27, 2020, 06:39:54 pm »
I am tempted to reject the job cause I just don't think I can ever make sense of this mess.

Have you plowed through something like this or have you ever declined to work on it.

That could still work if it is an indefinite position that expects you to clean up the code and make it sensible. A friend took a job like that and spent a few years knocking some terribly ugly Windows and VB6 code into good shape. He subsequent migrated it to .NET and now has a job for however long he wants it. He made himself indispensable, by both now knowing the problem domain and being one of the very few that can address it (as demonstrated by the code he started with.)
« Last Edit: April 27, 2020, 06:43:12 pm by jfiresto »
 
The following users thanked this post: I wanted a rude username

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #4 on: April 27, 2020, 07:03:11 pm »
I don't know how interesting the job otherwise is, so the decision is of course entirely up to you.

But having to deal with a large code base you don't feel comfortable with can be a real PITA, and if you know this is going to last for a long time (and not something just temporary), you'll have to really think hard about it.

And yeah, it looks likely that the company opening this position is expecting whoever takes it to save their ass with this hard-to-maintain piece of code, so it might well be your main responsibility, which would make the job even more uncomfortable.

Good luck deciding!
 
The following users thanked this post: snarkysparky

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 1869
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Have you turned down work because of quality of source code
« Reply #5 on: April 27, 2020, 07:29:52 pm »
for example

Code: [Select]
...


This routine formats a number into a string, beginning at the end of the string (least significant digit). Does look a bit strange, but not incomprehensible. Does something similar (but not exactly) to a sprintf(strp, "0%6d", bind) ...

One can even guess the meanings of the variables:
bind -> binary digit
ascd -> ascii digit
strp -> string pointer
« Last Edit: April 27, 2020, 07:33:06 pm by capt bullshot »
Safety devices hinder evolution
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2052
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #6 on: April 27, 2020, 07:34:25 pm »
Sounds fun to me.

A consultancy I once worked for was employed once (not me personally) to 're-write' a codebase where the outgoing developer had written it with the variable names all being expletives or such phrases... Apparently some were quite involved... of course it made their purpose somewhat tricky to derive.   :)

Understanding large code bases of undocumented code is a skill... make sure you charge for it.  :popcorn:

"No hierarchy of control."  ---> in very stack constrained environments this was not unusual.
« Last Edit: April 27, 2020, 07:39:55 pm by NivagSwerdna »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #7 on: April 27, 2020, 10:42:54 pm »
for example

Code: [Select]
...


This routine formats a number into a string, beginning at the end of the string (least significant digit). Does look a bit strange, but not incomprehensible. Does something similar (but not exactly) to a sprintf(strp, "0%6d", bind) ...

One can even guess the meanings of the variables:
bind -> binary digit
ascd -> ascii digit
strp -> string pointer

Good job deciphering this piece of code. ;D
Yeah, it might be understandable once you get to know the author's conventions. It's not necessarily that badly written. But one thing that would definitely put me off though, is that judging from the above function, it's not even ANSI C. I would not touch that with a stick. But that's just me, someone has got to do it. Again, good luck! ;D
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 6508
  • Country: us
    • Personal site
Re: Have you turned down work because of quality of source code
« Reply #8 on: April 28, 2020, 12:02:22 am »
This specific piece of code is not all that bad apart from non ANSI C part. But that depends on the target device. May be the only available compiler is that old. Although VxWorks suggests otherwise.

Whether I would work on something like that depends on a single (technical) factor - am I allowed to make code better as I go? If they insist that it must remain this way, you just need to add new things, then hell no. If this is just a legacy code base and they are looking to modernize it, then many times yes. I personally enjoy this type of work.

This implies long term full time employment. If this is a contract job, then I probably would not do that.
Alex
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2052
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #9 on: April 28, 2020, 09:20:10 am »
No takers to re-implement the code example?

It takes an integer value (bind) and a string buffer (pointed to by strp) with length (strlen)

First it fills the string with spaces
Then it converts bind to an ASCII representation which is right justified in the buffer
and returns the number of digits

e.g. 123 becomes "         123"   returns 3

So can you do better?

 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7596
  • Country: nz
Re: Have you turned down work because of quality of source code
« Reply #10 on: April 28, 2020, 10:18:27 am »
i would definitively make it clear in the contract that the current code is undocumented and you will spend significant time just understanding how it all works and rewriting sections.
Give them a price and time-frame that takes this into account.

Consider that you may not be the first person they have offered this job too.
It may have been turned down multiple times before for the same reasons you outlined,
so they may be willing to pay top dollar to get someone to do it,

It really depends how your brain works, some programmers enjoy figuring out and fixing crappy code as long as they are being paid good money. While other programmers hate it
« Last Edit: April 28, 2020, 10:22:20 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9730
  • Country: my
  • reassessing directives...
Re: Have you turned down work because of quality of source code
« Reply #11 on: April 28, 2020, 11:11:32 am »
for example

Code: [Select]
...


This routine formats a number into a string, beginning at the end of the string (least significant digit). Does look a bit strange, but not incomprehensible. Does something similar (but not exactly) to a sprintf(strp, "0%6d", bind) ...

One can even guess the meanings of the variables:
bind -> binary digit
ascd -> ascii digit
strp -> string pointer

i agree, its not totally incomprehensible. but you'll need some experience or knowledge under your belt. not really need a fancy experience, just some format converting experience or basic number converter normally available explained in book or somewhere else... such as this line clicks something...

Code: [Select]
strp = strp + (strlen-1);
this tells we move the position of string pointer to the end of the string.. and then...

Code: [Select]
ascd = bind % 10;
ascd |= '0';
*strp = ascd;
--strp;
bind = bind / 10;
take remainder (sort of base 10) of bind into ascd, format it somehow with '0' and put it at the end of the string and then moves the pointer backward toward the beginning of the string and fill it with formatted ascd. divide bind with base 10 again and redo...

trying to understand a piece of library/code base will need a lot of work (but not nearly the work of reinventing it from scratch), patience and slowly walk through it, regardless if its readable or not (currently i'm doing such task on Marlin FW ver 2 for 3D printer to put it in my 5-axis CNC project). one simple trick is copy paste that piece of code into our "workframe", inject it with expected input and see what its output in debug mode etc... another fancier method is map all the files in the library for their dependency and correlation (this function calls to which functions in which files?). but it needs a proper managerial tool SW. i diy one long time ago, but not really a completed one. anyway, you'll know if you have some blood to it or not sooner or later. the reason behind why you are doing it also can drive you to move forward and more... if you think its not worth it, then its a "quitter" ymmv.
« Last Edit: April 28, 2020, 11:31:19 am by Mechatrommer »
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 

Offline Syntax Error

  • Frequent Contributor
  • **
  • Posts: 257
  • Country: england
  • <[[ facemask ]]>
Re: Have you turned down work because of quality of source code
« Reply #12 on: April 28, 2020, 11:35:26 am »
It's good your prospective client has let you see the source code before you commit. Many clients/employers recruit stars who are experts in stuff like node, django or jenkins, and then drop them into their legacy CMS cesspool. Six weeks later, they're looking to fill their vacancy, again.

My opinion, the code is dense, suggesting the guys who wrote it were proficient coders when it was written. So don't expect any major fails. Or the need to rewrite it. But don't fall into the trap of over promising. It could take 6 months to unravel this coder's mindset. Not to mention managing the client's expectation of what you can achieve with the little they gave you.

Talk - ask what do they REALLY want you to do - or walk.

Good luck.

+++edit+++ Looking at the style of the code, it seems somewhat 'low level'. Maybe the developer was from an assembly language background?
« Last Edit: April 28, 2020, 11:46:06 am by Syntax Error »
 

Offline ace1903

  • Regular Contributor
  • *
  • Posts: 62
  • Country: mk
Re: Have you turned down work because of quality of source code
« Reply #13 on: April 28, 2020, 12:22:57 pm »
I experienced myself the same situation several times.
It depends if there is QA test team or some form of requirement specification for the project.
The worst case was when my employer wanted me to add a new feature on the existing spaghetti code.
I did that and several errors were reported. I was sure that my changes can not be blamed for the errors.
Then again I asked for a specification of how the product should work and perform in different test cases. I was told to look at the code and learn myself.
Found that several software developers worked on it and each of them did their tasks but not knowing specification they introduced several fatal bugs.

Now if I am offered a project with no documentation I simply refuse it.

You can learn what code does but not what it should do. It is easy to get the wrong conclusions just by reading the code.
If there is QA team you can ask which tect case fails, which tests are performed and expected results.

One man show for project and under time pressure is disaster for health both mental and physical. 
 
The following users thanked this post: snarkysparky

Offline snarkysparky

  • Regular Contributor
  • *
  • Posts: 189
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #14 on: April 28, 2020, 01:22:38 pm »
Well,  the decision was made for me.  They can't hire at this time and I am out the door.

Was going to decline the work anyway.  I don't like solving puzzles just to be solving them so i would be unhappy untangling that spaghetti code. I prefer to write my own  :-DD

Thanks for the input.   They don't have budget for anyone else.   Crazy times....

 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #15 on: April 28, 2020, 02:24:57 pm »
They don't have budget for anyone else.   Crazy times....

I have seen that already. Yep, pretty crazy...
 

Offline SimonR

  • Regular Contributor
  • *
  • Posts: 121
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #16 on: April 28, 2020, 02:27:02 pm »
Was going to decline the work anyway.  I don't like solving puzzles just to be solving them so i would be unhappy untangling that spaghetti code. I prefer to write my own  :-DD

Probably the right decision, I have done this on a similar sized project, it takes forever. You have to convert the bits you are working on as you go along otherwise you run the risk of breaking it. This can take many times as long to do so you need your employer to agree that this is going to happen otherwise you have no chance.
The converted project is still running after 5 years and is much improved but I still find bits that have never changed.

Quote
+++edit+++ Looking at the style of the code, it seems somewhat 'low level'. Maybe the developer was from an assembly language background?

Not necessarily true. The example is original K&R C which had a limitation on symbol name length of 8 characters so everybody used cryptic names back then. Almost all C code looked like that.
You could use longer names but only the first 8 characters were counted so you ran the risk of mixing variable names up and not realize.

Code: [Select]
May be the only available compiler is that old.
Non ANSI C still compiles in C99, or at least the example here still does. The only major difference is the parameter definitions appearing before the { and that still works. Probably the next problem are the differences in what is determined to be undefined behaviour.


Code: [Select]
No takers to re-implement the code example?
If you don't care what the exit value is then you could just replace it with something like

ULONG strlen = 10;
sprintf(strp, "%10ld", bind);

However if you care about the number of digits in the decimal number then you have to re-write the existing function.
Also you might have a dynamically sized buffer which is a problem for the format string "%10ld"



 
The following users thanked this post: I wanted a rude username

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 2664
  • Country: fi
Re: Have you turned down work because of quality of source code
« Reply #17 on: April 28, 2020, 02:29:18 pm »
A totally flat huge blurb of C functions, some of which are unused, while not a dream job, is not at all the worst possible. It looks nasty, but there is a limit to its nastiness: it likely isn't totally unsalvageable. This kind of project looks like horror on the first sight, but you start making sense on it piece-by-piece: you can easily delete unused code, then follow function calls.

Naming conventions are like assholes, everybody has one and no one likes the others'. You start getting used to the random-seeming names.

The "benefit" of such design is that if any of those functions are actually doing something difficult to reproduce, they are easy to reuse as-is because there is no huge tree of architectural dependencies like in an over-engineered and badly designed object-oriented cathedral which is not too uncommon at all. Such a case may look like very well-structured on surface, but once you start working on it, you find out you can't do anything on it since it would need complete redesign. Such projects may have tens of thousands of source files which all contain almost exclusively boilerplate.

If you have 350 C files with a bunch of functions each, you have good chances of being able to actually locate the interesting parts (algorithms and datatypes) and follow them.
« Last Edit: April 28, 2020, 02:33:54 pm by Siwastaja »
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2052
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #18 on: April 28, 2020, 06:24:19 pm »
sprintf(strp, "%10ld", bind);
Nice try but think of the overhead of pulling in sprintf... might be too expensive... might pull in too much code and static stuff... if it even exists.
 

Offline SimonR

  • Regular Contributor
  • *
  • Posts: 121
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #19 on: April 28, 2020, 09:18:39 pm »
sprintf(strp, "%10ld", bind);
Nice try but think of the overhead of pulling in sprintf... might be too expensive... might pull in too much code and static stuff... if it even exists.

It does exist, sprintf is in K&R version 1, look it up, I did that's why I suggested it. It uses almost no resources just 0x58 bytes of code and no ram according to my MAP file. I have only 32K of RAM in my system which is very heavily used by my application.

Plus its only a suggestion, a time period compatible one. You would have to move to a newer compiler to get longer names anyway
« Last Edit: April 28, 2020, 09:20:17 pm by SimonR »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 6508
  • Country: us
    • Personal site
Re: Have you turned down work because of quality of source code
« Reply #20 on: April 28, 2020, 09:21:39 pm »
It uses almost no resources just 0x58 bytes of code and no ram according to my MAP file. I have only 32K of RAM in my system which is very heavily used by my application.
There is absolutely no way printf() uses 0x58 bytes of code. Typical printf() on Cortex-M0+ is about 20K of code.

So it is possible that compiler is smart and parsed the string and substituted some version of itoa().

Obviously if you already use printf() some place else, it does not really matter, might as well use it here.
« Last Edit: April 28, 2020, 09:23:29 pm by ataradov »
Alex
 
The following users thanked this post: NivagSwerdna

Offline SimonR

  • Regular Contributor
  • *
  • Posts: 121
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #21 on: April 28, 2020, 09:43:54 pm »
You are of course correct I only did a quick look without thinking about it.
Adding up all the bits of my xprintflarge library seems to add up to about 14K, there's probably some dependencies as well. I used to use the small library until I needed something it didn't support.
I originally avoided it for a very long time for fear it used too much resource, then discovered it wasn't as bad as I thought. I don't care so much about the code size as much as the RAM footprint.

In any case it was just a period correct alternative suggestion assuming you didn't depend on the returned count being correct.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #22 on: April 28, 2020, 10:52:28 pm »
Yes, compilers are smart enough to do that.
Likewise, if you're only using printf() with no format tags, the compiler will usually call puts() instead, which takes very little code.
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1149
  • Country: fi
Re: Have you turned down work because of quality of source code
« Reply #23 on: April 29, 2020, 06:07:02 am »
Dealbreakers for me would be unrestricted use of globals and pointers. With cryptic, but otherwise correct code, you have the option of encapsulating it, and add documentation as you go along, but if it's also broken you're probably better off starting over from scratch.

If they were explicitly looking for help with modernizing their code base, there are people who specialize in that, but as with all experts, they can be expensive. You just have to make the judgement call if it'll save money in the long run.

Offline HwAoRrDk

  • Frequent Contributor
  • **
  • Posts: 733
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #24 on: April 29, 2020, 09:12:27 am »
A consultancy I once worked for was employed once (not me personally) to 're-write' a codebase where the outgoing developer had written it with the variable names all being expletives or such phrases... Apparently some were quite involved... of course it made their purpose somewhat tricky to derive.   :)

I once worked on a codebase of a piece of software that my then-employer's parent company bought out from a third-party consultancy that ran it as a SaaS for their clients (of which my employer was one). The lead programmer apparently favoured 'shit' as his one-size-fits-all noun that was used liberally in comments all across the code. For example: "copy the shit", "take the shit from the DB result and put it in the list", "delete this shit", "format the shit", etc, etc. :-DD
 
The following users thanked this post: NivagSwerdna

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2052
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #25 on: April 29, 2020, 09:23:05 am »
It does exist, sprintf is in K&R version 1, look it up, I did that's why I suggested it.
Harsh!  Just because something existed in a language specification doesn't mean it existed in the development environment and even if it did its use might not be advisable depending on hardware constraints.  Specifically you get very dependent on how clever the linker is and if it can be very specific and also using any library adds additional stack constraints. 
My memory fails me but I believe in some PICs you only got about 6 levels of stack... something tiny and you need to account for an interrupt too... in that kind of environment calling anything (unless the call is optimised out) uses precious resources.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 3613
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Have you turned down work because of quality of source code
« Reply #26 on: April 29, 2020, 09:54:02 am »
At least you had the chance to see the code before deciding to take the job or not. TBH the state of the code wouldn't worry me nearly as much as how easily - or not - you can test any changes you make.

I've had to turn down a couple of software jobs for just this reason, and one in particular sticks in my memory.

"Give us the code and 3 weeks, and we'll tell you if it works or not" wasn't the answer I was looking for.

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9730
  • Country: my
  • reassessing directives...
Re: Have you turned down work because of quality of source code
« Reply #27 on: April 29, 2020, 10:53:06 am »
never took a programming job except for freetime hobby and once as a RA 20yrs ago but if someone come to ask "program this and if its work you get your money, otherwise your weeks of hardwork will go down the drain" i will say to them "you can go f yourself".
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 

Offline Syntax Error

  • Frequent Contributor
  • **
  • Posts: 257
  • Country: england
  • <[[ facemask ]]>
Re: Have you turned down work because of quality of source code
« Reply #28 on: April 29, 2020, 01:31:13 pm »
Quote from: HwAoRrDk
... The lead programmer apparently favoured 'sh...
Clearly that hack did not go for peer reviews... or he was a 'lead programmer' so code shone out of his var_se anyway?

Lord of the Rings and Hogworts references litter code from script kiddies. Even Manga and K-Pop gets a look in. Which is easier to reverse engineer than code where every object is called 'o'.

 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #29 on: April 29, 2020, 01:41:58 pm »
Yeah, using comments like this either means that was a lone developer with no code review whatsoever (the most likely), or the whole team was a bunch of weirdos. :-DD
 

Offline HwAoRrDk

  • Frequent Contributor
  • **
  • Posts: 733
  • Country: gb
Re: Have you turned down work because of quality of source code
« Reply #30 on: April 30, 2020, 10:07:04 am »
The ironic thing was that the code was pretty good. It's just the comments were of a scatological nature and lacking a bit in insight.

I have no idea whether any of the code was peer reviewed. The 3rd-party consultancy that developed it had 50+ developers, but I don't think more than a handful of people ever worked on the thing.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #31 on: April 30, 2020, 02:05:06 pm »
Putting shit like this everywhere as a placeholder looks a bit like the smurf language... only a bit more offensive.
 :-DD
 

Offline IDEngineer

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #32 on: May 06, 2020, 11:05:18 pm »
Indirectly, yes.

A former employer once sent me to evaluate a code base they were considering buying from a bankrupt technology firm. To my horror, the code had NO comments, no documentation, nothing. Just source. And it was basically unreadable with variable names that bore no relationship to what they were used for, etc. I recommended STRONGLY that they skip this "opportunity" since I viewed it as a money sink that would not only work out poorly, but also make anyone who touched it (read: Engineering) look terrible. Even the representative from the bankrupt firm that managed my access to it said he'd run, not walk, away from the purchase.

Nevertheless, our Sales and Marketing droids forced their way and my employer bid on the asset. Thankfully they got into a bidding war with another company, and lost. Sales and Marketing were furious, but I told everyone in Engineering that our department and the company as a whole had dodged a bullet. You just know that Sales and Marketing would have been first in line to criticize Engineering's inability to make this code work.
 

Online Tomorokoshi

  • Frequent Contributor
  • **
  • Posts: 875
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #33 on: May 17, 2020, 11:27:19 pm »
In this case, a lot of what drives the decision comes down to:

1. What is the timeframe of getting the system to be somewhat documented and understood?

2. What are the requirements for any upcoming changes? What is the schedule for those changes?

3. What is the willingness of management to take on the costs in software analysis tools to help figure it out? Let's ballpark $25,000 as a starting point for various tools until something is found that helps. This doesn't include research and engineering time.

4. What is the projected lifetime / revenue of the product line after updates?

5. Do you have access to all the tools used by the previous engineers, or are licenses, software, and dongles lost?

6. If this is an embedded system, are there issues with circuit board updates or part obsolescence?

The effort breakdown is probably something like 10% programming, 30% engineering, and 60% management until the updated system gets running smoothly. Note that it's possible that the updated system will never actually run smoothly, or that market conditions will eventually cancel the project.
 

Offline hulk69

  • Newbie
  • Posts: 3
  • Country: fr
Re: Have you turned down work because of quality of source code
« Reply #34 on: May 19, 2020, 01:14:56 pm »
Oh man this post is resonating with me so much!

I am working on taking over/maintaining a huge C project done by people who had no business writing code.
This is the most depressing time in my professional carrier. This thing is a living nightmare, your code compare to it looks like art!

 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3197
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #35 on: May 22, 2020, 02:53:42 am »
There's a certain challenge and satisfaction that you can get from learning how particularly mysterious code works.Whether I'd turn down "work" for that sort of thing would probably depend on whether the employer understood that that was going to be the problem.  If they know they're in deep crap and are willing to spend the time and money to get it fixed, that's an entirely different situation than if they think their current code is wonderful and they just need someone to make a few changes.
 

Offline guenthert

  • Frequent Contributor
  • **
  • Posts: 388
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #36 on: June 05, 2020, 04:38:22 pm »
  The quoted code might not have been pretty, but it was by no means obfuscated.  I would say about standard for older C. 

  Unless it's assembler, I don't expect much comments within the code, but appreciate if there is (as long as it (still) matches the code, which sadly isn't a given).  More important to me is documentation outside the code -- some kind of product requirement document, worklog, changelog etc. .  Is the code under some version control (if not, that might be the answer you're looking for), how do the check-in comments look like?  Is the motivation of changes documented (or does the author only state the obvious, as in "added foo() to bar.c", which is all too common or mysterious, as in "fixed baz()")?  Is there a defect database (for larger projects IMHO a must)?  Is that defect database consistently(!) referred to in the version control check-in comments? 

  And yes, I chose to decline a work-offer once, but that involved a collection of shell scripts a different company already declined to work on ...
« Last Edit: June 05, 2020, 04:43:48 pm by guenthert »
 

Offline Michael Rempel

  • Contributor
  • Posts: 11
Re: Have you turned down work because of quality of source code
« Reply #37 on: June 05, 2020, 08:26:34 pm »
Personally I am a professional software architect. When I looked at those snippets I saw that it was written by a total amature. Experienced developers acquire a few really good ways to do things over the years. That code has none of them.

I think you were facing one of two possibilities:
1) they have hired the cheapest dev they could find in the past. It is now biting them hard.
2) the guy who wrote it is the one trying to hire you.

Both of these are a nightmare. Good choice to let it go.

And by the way, yeah I have let projects go. Even when I was very hungry, for just these reasons.
Be careful with people like them, they can bad mouth you and cause you lots of grief. Wish them well and forget to anwser their calls.
 

Offline Warhawk

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: 00
    • Personal resume
Re: Have you turned down work because of quality of source code
« Reply #38 on: June 05, 2020, 10:02:18 pm »
Run Forest, RUN!

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3197
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #39 on: June 06, 2020, 05:44:05 pm »
With the proper experience, you pretty much INSTANTLY recognize that last panel as a mouse trap...

 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 15258
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Have you turned down work because of quality of source code
« Reply #40 on: June 06, 2020, 06:02:46 pm »
Perhaps, but it's too large to hold a mouse.  It seems more like a... developer trap? ;D

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 3613
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Have you turned down work because of quality of source code
« Reply #41 on: June 06, 2020, 06:37:59 pm »
With the proper experience, you pretty much INSTANTLY recognize that last panel as a mouse trap...

Exactly!

More specifically, it's the mouse trap that you end up with if you just #include "mousetrap.h" and don't think too hard about how that particular mouse trap is implemented, what resources it requires, or how long it takes to execute. After all, it's a library that someone else wrote, a long time ago, so it must be tried, tested, reliable and fit for purpose - right?

Offline stafil

  • Regular Contributor
  • *
  • Posts: 194
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #42 on: June 07, 2020, 01:45:43 am »
How easy can you find another job?

 

Offline dietert1

  • Frequent Contributor
  • **
  • Posts: 480
  • Country: de
    • CADT Homepage
Re: Have you turned down work because of quality of source code
« Reply #43 on: June 07, 2020, 09:33:01 am »
Yes, try to get that job, with a contract including your findings. Which means design and docs, no coding. You seem to be the right person to recover that project from the dumpster. Later, if you write one file per day, after another year the project will be yours.
I have been recovering many projects like this - for years. Somehow it stopped after one large year 2000 project that took me about five years. It gave me so much income that i could build my own business, yet i may have become a bit messy, too.

Regards, Dieter
 

Offline tkamiya

  • Super Contributor
  • ***
  • Posts: 1375
  • Country: us
Re: Have you turned down work because of quality of source code
« Reply #44 on: July 07, 2020, 06:12:31 am »
A lot of production code I've seen are like that....  When the code was originally written 10+ years ago and multiple people has had their hands in it, spagetification tends to happen.  Workaround of workaround of workaround isn't fun to fix.  But it's a reality in a lot of places.

Every now and then, I get fed up with it and take out all that code and clean it up.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf