5 ms·
Should I try to convince my client to fire his current developers?
His code base is atrocious. I just got this contract and I'm trying to be as professional as possible by giving my client examples of why he needs to change the way he is doing things on the technology side to avoid certain disaster.
The code clearly exhibits that the developers do not understand programming in several instances. There are is-a relationships used where has-a would be appropriate as well as code that is just completely in the wrong freaking place, to put it bluntly. Misspellings are abundant and there is no documentation. All the code is formatted like trash and I seriously doubt that even the original developers (an outsourcing company who are obviously specializing in making shitty websites as fast as they possibly can and didn't even bother to open up a programming book before trying) would be able to read the code.
Any advice on explaining this to him? None of the code is in version control, documented, or has any heirarchical structure. Tons of code is repeated, there is voodoo code, yoyo code, bulldozer code, and several examples of developers copy pasting and obviously not reading docs at all.
Here is one of the cutest things I found:
function formatAvgRating($average_rating){
124 if($average_rating <= "0.25" ){
125 $average_rating = "0";
126 }else if( $average_rating > "0.25" && $average_rating <= "0.75" ){
127 $average_rating = ".5";
128 }else if( $average_rating > "0.75" && $average_rating <= "1.25" ){
129 $average_rating = "1";
130 }else if($average_rating > "1.25" && $average_rating <= "1.75" ){
131 $average_rating = "1.5";
132 }else if($average_rating > "1.75" && $average_rating <= "2.25" ){
133 $average_rating = "2";
134 }else if($average_rating > "2.25" && $average_rating <= "2.75" ){
135 $average_rating = "2.5";
136 }else if($average_rating > "2.75" && $average_rating <= "3.25" ){
137 $average_rating = "3";
138 }else if($average_rating > "3.25" && $average_rating <= "3.75" ){
139 $average_rating = "3.5";
140 }else if($average_rating > "3.75" && $average_rating <= "4.25" ){
141 $average_rating = "4";
142 }else if($average_rating > "4.25" && $average_rating <= "4.75" ){
143 $average_rating = "4.5";
144 }else if($average_rating > "4.75" ){
145 $average_rating = "5";
146 }
Should I tell him this is how a competent individual would write it?
function formatAvgRating($rating) {
$rating_floor = floor($rating);
$part = $rating - $rating_floor;
if ($part < .25)
return $rating_floor;
else if ($part > .75)
return $rating_floor + 1;
else
return $rating_floor + .5;
}
???
So many decisions..
- shirtless_coder 16y agoEDIT: wish this had syntax formatting. Anything for that supported?
- djb_hackernews 16y agopastebin.com
- GrandMasterBirt 16y agoBe careful. 1) Do your contract. If asked then respond with that. 2) Do a good job, let your client see clearly YOUR code is superior. 3) Let your client keep their shitty coders. By stating the above, you potentially destroy a relationship with a client. Unwarranted too.
- Unseelie 16y agoDo you want to take over their job? If not, do you have a cheap, competent replacement? If the replacement isn't as cheap as the apparently horrendously long code, can you show noticeable differences in runtimes?
- thetrumanshow 16y agoSorry, I know that we tend to be purists and want our functions to be all clean and tidy and use like.. zero lines of code, but I understood what the cute code is trying to do in like 0.2 seconds. If I were hiring something out, this is code is actually fine with me. It takes some mental energy to actually look carefully at the cleaner solution. Different strokes...
- Rust 16y agoI'd much rather see code that might take an extra second or two to recognize than code that will need to be completely rewritten X times, constantly maintained, or is otherwise "stupid" (a technical term I use sometimes). The example code is exactly the type of thing that would raise my hackles - only a really, really bad developer would write that. It's not only easier to write it correctly, but faster.