Page 1 of 2 12 LastLast
Results 1 to 15 of 29

Thread: Grrarrrgh, terrible code - Web Dev Vent Megathread

  1. #1
    Join Date
    8th December 2009 - 16:11
    Bike
    Nothing, sadly
    Location
    Browns Bay
    Posts
    175

    Grrarrrgh, terrible code - Web Dev Vent Megathread

    Shitty code is the absolute worst. The only advantage, as far as I can see, is that it pays my bills, otherwise it's frustrating to work with and everyone with a terribly coded website has one because they can't afford it to be well coded/recoded. So you have to work around the fucker, and the net cost is usually greater than if they just paid for it to be coded well in the first place.

    So you're left working with garbage.

    Thankfully no one has yet complained as I keep pushing up my hourly rate every couple months.

  2. #2
    Join Date
    25th January 2007 - 10:06
    Bike
    '14 Multistrada 1200S
    Location
    palmy
    Posts
    3,759
    i feel your pain....
    F M S

  3. #3
    Join Date
    3rd September 2009 - 14:30
    Bike
    zx12
    Location
    Auckland
    Posts
    511
    There's also the marginal cost to consider. You can either spend a month (optimistically) redesigning everything from scratch and then another month migrating and testing OR you can spend a month adding some new feature that will make the business more money. There's no contest from the business' point-of-view.

    Unfortunately the pain that devs put up with and the inevitable complaints don't outweigh the money.

    Like you say, the flipside is that you're gainfully employed and probably pretty indispensable to your client. Rejoice! You've got job security. As soon as they've got a clean codebase they'll need less of your time and could probably replace you with a nub. If anything you should tack on some incredibly obscure (but cool sounding) technology and prepare for retirement.

  4. #4
    Join Date
    6th May 2008 - 14:15
    Bike
    She resents being called a bike
    Location
    Wellllie
    Posts
    1,494
    Blog Entries
    3
    I feel yer pain too. We were asked to write a system back in August. And I was to start designing it. All of a sudden, the 3rd party contractor is coming in (albeit decent guys), told to down design tools and just start getting on with it. Ugh...

    Crap code replaces well thought out code... fingers crossed she holds together come launch day
    I didn't think!!! I experimented!!!

  5. #5
    Join Date
    25th June 2007 - 21:21
    Bike
    S1000RR
    Location
    Christchurch
    Posts
    6,988
    Any personal opinions/hints/tips to avoid writing crappy codes?


    If you can make it on Kiwibiker you can make it anywhere.

  6. #6
    Join Date
    3rd September 2009 - 14:30
    Bike
    zx12
    Location
    Auckland
    Posts
    511
    Quote Originally Posted by EJK View Post
    Any personal opinions/hints/tips to avoid writing crappy codes?
    I think most code eventually winds up being crappy. Someone will have designed it for one purpose and then some new requirement comes along and a new feature is rushed in. Rinse and repeat over a number of years until someone gets pissed-off and starts from scratch again.

    Code also become annoying as the technology (Visual Basic, Java, Objective-C ) evolves which may break functionality and introduce new practises. Someone new looks at the code and says "Oh that suxors, I learnt to do that a different way at 'tech"

    In a general sense there's heaps of ways to do coding well; validation of input, checking of system call return codes, DB normalisation etc. The thing to be aware of is that there is no such thing as perfect code, or a perfect style, each method has different pros/cons in terms of time spent (development speed), ease of debugging, time to train new team members, maintainabity etc

  7. #7
    Join Date
    8th July 2009 - 14:02
    Bike
    R1150RT
    Location
    The Nest
    Posts
    4,693
    Blog Entries
    2
    Quote Originally Posted by EJK View Post
    Any personal opinions/hints/tips to avoid writing crappy codes?
    Read any Microsoft code and then avoid like the plaque and run like hell.

  8. #8
    Join Date
    31st March 2005 - 02:18
    Bike
    CB919, 1090R, R1200GSA
    Location
    East Aucks
    Posts
    10,498
    Blog Entries
    140
    Don't seek to write perfect code either. Like most jobs, perfection has to be balanced with delivery. It certainly needs to be functional and data integrity enforced etc. I prefer managing networks to being a code monkey, but basic coding is still used.

  9. #9
    Join Date
    14th April 2007 - 20:27
    Bike
    track bike
    Location
    Wellington <-> Sweden
    Posts
    867
    Blog Entries
    1
    Steve McConnell's 'Code Complete, Second Edition' is a very good read on the topic.

  10. #10
    Join Date
    8th December 2009 - 16:11
    Bike
    Nothing, sadly
    Location
    Browns Bay
    Posts
    175
    My rules are write like it has to be read, white space doesn't add much to a page loading time and lord does it make things easy.

    And if you HAVE to use absolute positioning, can you still at least put the divs in order, not a mishmash.

    Boxes seperating sections would be nice too, even if you use absolute positioning, and if margins/positioning etc are defaults, then you don't need to write them in.

    Issues I was fighting with on the last one. It was like they intentionally wrote it so that it couldn't be read by anyone but the author. Ended up having to bin a lot of the code and rewrite a chunk.
    And notes! If you're using dynamic code that calls from various places. Just HTML doesn't need notes(unless it's a mishmash that uses obscure ids) but if you're calling from ../xxx/xxx/xxx/xxx/xxx/xxx/johnsdog.php that calls a function from ../xxx/sss/fff/config.php that extends a class, notes would really be nice.

    Readability defines good code to me, rather than efficiency. Although efficiency is a close second. If it's neither you have terrible code. If it's both I want your children. I'll find a way.

    Edit: And LORD, if you're putting a left position in, don't put a right in too. And don't float everything if you're absolute positioning. It's just pointless code that does nothing but frustrate me.

  11. #11
    Join Date
    9th November 2005 - 18:45
    Bike
    2005 Z750S
    Location
    Wellington
    Posts
    1,136
    Quote Originally Posted by Suntoucher View Post
    Issues I was fighting with on the last one. It was like they intentionally wrote it so that it couldn't be read by anyone but the author.

    That's why I hate the way most people implement CSS.

    Yes, it's all very good the way inheritence of styles works, and it's nice how you can sub-class the style selectors and all that; but geez it's hard sometimes to figure out why that box over there looks that way.

    Oh, it's inheriting this style from there because it's a child of that element with that style, except it's in a div with this ID and...

    Bah.

    I think CSS ends up being worse than "real code" sometimes.
    Measure once, cut twice. Practice makes perfect.

  12. #12
    Join Date
    6th May 2008 - 14:15
    Bike
    She resents being called a bike
    Location
    Wellllie
    Posts
    1,494
    Blog Entries
    3
    Quote Originally Posted by EJK View Post
    Any personal opinions/hints/tips to avoid writing crappy codes?
    Like said above. It's pretty hard to get around with the amount of scope creep that goes on. KISS. Error handling is a must (write an error handler that will send an email to an application error email box listing the error, page, class, module and user name info etc... that way you receive the error before the user realises something is wrong.). Funny when ya phone 'em too

    Keep it functional/modular (people may disagree). Function does X, meets business rule y etc... Simple, logically named, easy to find modules. (no frilly interfacing etc...)

    Nullify all objects once you've finished with them. Don't wait for the garbage collector.

    You'll find your own style as you go. Good luck fella...
    I didn't think!!! I experimented!!!

  13. #13
    Join Date
    25th January 2007 - 10:06
    Bike
    '14 Multistrada 1200S
    Location
    palmy
    Posts
    3,759
    i don't have worry too much with CSS, all our stuff is web apps so it's more about functionality than presentation, good OO, sensible encapsulation (where appropriate) and a strong framework FTW as far as my systems are concerned!

    I'm currently rewriting an accounting module and instead of using additional database tables for one particular relationship, the originator stored a serialised array of related data as a fekkin string in one field FFS!
    F M S

  14. #14
    Join Date
    20th April 2003 - 08:28
    Bike
    Something red and quick
    Location
    Auckland
    Posts
    2,499
    I feel your pain!

    Let's just say my main job is similar to fixing patients who have had very bad plastic surgery but with all their money already siphooned by the bad surgeons in the first place. And to make matters worse, often their parents wouldn't consent to the recommended surgery fix because the last surgery was the cause of all the problems.
    Elite Fight Club - Proudly promoting common sense and safe riding since 2024
    http://1199s.wordpress.com

  15. #15
    Join Date
    4th May 2006 - 22:17
    Bike
    1987 GPX 250
    Location
    New Zealand
    Posts
    3,445
    I thought about redesigning my local Thai Boxing clubs' website but some other dude got in first and made this: http://www.wtk.co.nz/

    Now it is better than the old version...but only just. I can't quite believe he let this half assed job be published.


    And on a completely unrelated note i have a mate getting paid to write PHP when he has never done it before. He googles to find out how to do it! Frustrating as nobody even wants to see what i can do let alone think of hiring me.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •