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..