weblog . Biography . Flexibility . projects
  • photography by Kristel van Beek

    Flash CS4 IDE navigateToURL bug on the Mac
    Flash Player Bitmap Limits Again

    21 May: Sloppy code

    posted by: martijn, at 21 May 2009 8:02 GMT+1, 21 May 2009 8:17 GMT+1

    Ever since I became interested in programming I stumbled upon bad formatted code. The reason someone writes such code is because he is sloppy and fails to see the importance of clean written code.
     
    • Bad indenting is probably the worst crime committed daily.
    • Using as spaces instead of tabs for indenting are for me unbelievable (there is reason to use tabs instead of spaces, because tabs appearance are adjustable you should use tabs instead of spaces).
    • Mixing tabs and spaces is far worse.
    • Using names as “a” for method names just because it is written faster is also a thing I see very often.
    • Using names as “r” for important data, not just for an iterator or some other not critical variable.
    • Double code (just copy/paste something is probably faster than just making a method for it).
    • No comments at all.
    • Comments that still exists but the code it explains is already gone.
    • Using method names that don’t make sense at all, the method name should describe it purpose.

    Why are developers sloppy with this? Is it because I’m original a designer that I care about this? Code should look clean and tidy as far as the language permits (eg. php code can look messy because of the dollar sign). Code that is clean and tidy is far more readable, even when it is missing comments in opposite of code that is messy with a lot of comments.

    I wonder if a messy developer is proud of his work, and what he thinks if he sees work of himself that is more than 6 months old.

    I don’t pretend that all my code is clean as it should be it cam always be better, and I’m much happier that I’m currently surrounded with developers that do care more than I ever saw.

    Add this link to del.icio.us vote in HexoSearch permalink - tags: flash | flex | javascript | php | javascript - 6 Comments
    Write a comment for this article

    6 Comments

    • Taylor says:

      at 21 May, 2009 13:52 blogs.4point.com/taylor.bastien/
      Hi Martijn,I agree that there are some aggravating coding crapstorms to be found out there. (I know I've created my own at times in the past.) They all have a root cause, though:Apathy -- In some cases, people either forget that they aren't the only person who will see the code, so they don't care.Ignorance -- They don't know any better, since they are having a hard enough time getting it to work as it is.Arrogance -- They want to impress people that they can keep 50 plates spinning in the air/get squirrelly code to run.This last one leads to what I (unfairly?) call "PERL stye" code where the developer tries to do everything in a method in one line: return + ternary operators or other obscure syntax + non-descrptive variabe names. It makes him/her feel good to be the only person who can understand what it's doing.I've also run into code where the coder threw in a try/catch and in the catch just say in a comment that they're not sure why but they expect this error to happen. (This woud fall under "ignorance). Anytime a coder is clearly confused by his own code, he might need to take a big step back, catch his breath and break it down into more transparent pieces.That's what I can come up with, first thing in the morning (7:00AM). Have a great one, Taylor
    • Sean Moore says:

      at 21 May, 2009 16:59 www.seantheflexguy.com/blog
      Hey there! Great post. I totally agree with you. Spaces instead of tabs KILLS me. Copy/paste coding is terrible. One letter method and variable names are horrid. Mixed tabs and spaces is brutal. Bad indenting is just straight lamesauce.I thought you had an interesting point about being a designer. I never really thought about that before. I was/am a designer as well and then got pretty heavily involved in software development. Maybe that does have something to do with it.... At any rate I never understood why people don't take pride in their work. I do mostly Flex development now so the source isn't available but when you're talking HTML/CSS the source is always just one right click away... How embarrasing ;)Anyway, great post. Keep up the good work and keep fightin the good fight!Peace,Sean
    • Gooswa says:

      at 21 May, 2009 21:17 old.dubink.com
      I agree totally about horrid looking code. I just had a nightmare with a css project that had a lot of duplicate classes and selectors. One thing I do all the time though that people will probably throw tomatos at me for is I hardly ever comment my code. Why? cause I think I do a pretty good job of giving my variables descriptive names, and I could care less if a method/variable name is super long (what does it matter, it gets turned into byte code anways right?). I probably should comment my code more, but to me sometimes when I am the only one thats ever going to be looking at the project I could careless about comments. Maybe if I actually got a project that I couldn't handle myself and needed another coder then I would start being a better commenter.
    • Hans says:

      at 28 May, 2009 23:23 www.dandy.nl
      HeyRemember me? I am the sloppy coder.But seriously.Bad indenting is probably the worst crime committed daily.I agree.Using as spaces instead of tabs for indenting are for me unbelievable (there is reason to use tabs instead of spaces, because tabs appearance are adjustable you should use tabs instead of spaces).Well. I always use tabs. But with a tab size of 4 every one lese uses 8. So when editing old code of some one else and using tabs Other people reading the file go beserk. Looks super messy. if you want to be sure a 100% that your code looks the same for every one you should use spaces. But I stick to tabs anywayMixing tabs and spaces is far worse.Totally agree. The reason why is above. Double code (just copy/paste something is probably faster than just making a method for it).Double code sucks but I never use methods.Comments that still exists but the code it explains is already gone.What worse, Commenst that explain code that has been changed and does other things than the comment tells you!Using method names that don’t make sense at all, the method name should describe it purpose.Again methods suck. But I am olf fashioned.hee maar de groeten uit Almere hoe gatie verder?hansgPs I had to maximize my exploder 7 window before I could find the "send:" button. A bit sloppy? :-)    
    • Martijn van Beek says:

      at 29 May, 2009 11:12 martijnvanbeek.net
      Sloppy code is not equal to bad layouting Hans ;). (worse is the fact that the comment panel doesn't work in Safari).But thanks for the tip I fixed it! (you need a bigger screen!).
    • dave says:

      at 3 January, 2010 2:57
      Thank you.  I'm so sick of crappy code.  It makes it impossible to read.
      function a ($d){ 
      	if (is_null ($d) {
      		$d = 0; 
      	} else {
      		$d ++;
      	}
      	return $d;
      }
      function IncreaseVar ($DataInput){
      /*
      INPUT:  $DataInput - the var to increase in size.   
      DESCRIPTION: We increase it by one, or we init the variable.   
      RETURN:  Modified $DataInput*/
      	if (is_null ($DataInput)
      		$DataInput = 0;
      	else
      		$DataInput ++
      	return ($DataInput);
      }
      
    Write a comment for this article
  • categories
    • flash (26)
    • flex (26)
    • flash player (10)
    • php (7)
    • adobe (6)
    • eclipse (5)
    • weblog (5)
    • open source (4)
    • red5 (4)
    • mac (4)
    • linux (4)
    • apple (4)
    • style (4)
    • windows (3)
    • air (3)
    • apollo (3)
    • javascript (3)
    • design (3)
    • firefox (3)
    • flash media server (3)
    • uimodifier (2)
    • silverlight (2)
    • support (2)
    • microsoft (2)
    • bitmap limits (2)
    • internet explorer (2)
    • safari (1)
    • team (1)
    • chrome (1)
    • devigner (1)
    • git (1)
    • flex builder (1)
    • opera (1)
    • mxna (1)
    • google (1)
    • msn (1)
    • internet provider (1)
    • dell (1)
    • advertisement (1)
    • developer (1)
    • repent (1)
    • nintendo wii (1)
    • java (1)
    • music (1)
    show all
  • all articles
    • February, 2010
    • Flash on Mac Faster
    • December, 2009
    • Historic moment (somehow), Microsoft names Devigner in an article.
    • Universal filesystem
    • November, 2009
    • Projects get a home
    • October, 2009
    • I'm a daddy from now on, her name is Julia
    • My projects moved to GitHub
    • SWFLoader fails where Loader succeeds
    • September, 2009
    • Note to self: Ant Java heap space on Mac OS
    • August, 2009
    • Flash Player Bitmap Limits Again
    • May, 2009
    • Sloppy code
    • April, 2009
    • Flash CS4 IDE navigateToURL bug on the Mac
    • Flex Builder Gumbo expired
    • March, 2009
    • Dear Steve II: The files problem
    • Dear Steve I: The support problem
    • January, 2009
    • Flash Player Bitmap Limits
    • December, 2008
    • Google Chrome and why I use it for Flex debugging
    • November, 2008
    • UIModifier, release 0.0.1
    • October, 2008
    • AIR and Icons
    • Matrix rotation
    • September, 2008
    • CS4 announced, still huge price differences
    • Dear Adobe
    • Browser (technology) war
    • July, 2008
    • mx.effects.Move is Evil
    • Adobe, why no 64-bits Flash Player?
    • Collaboration with Adobe Flex
    • June, 2008
    • My vision on the web video future
    • Flex Builder rename bug (?)
    • May, 2008
    • Flash TextField bug?
    • Astro, Flash Player 10 prerelease has arrived
    • April, 2008
    • Released new website for Kristel van Beek
    • Portishead
    • March, 2008
    • IE7 + HTTPS + Flash
    • Mac experiences
    • I'm a mac now
    • February, 2008
    • AIR, my opinion!
    • Ubuntu living under Windows
    • Pulse, Eclipse on demand
    • January, 2008
    • Zend Neon becomes Zend Studio for Eclipse
    • BlueBerry needs Developers
    • Sparkling new website
    • December, 2007
    • Super Mario Galaxy
    • Apple, please deliver a 15" MacBook Pro with 1920x1200 resolution
    • November, 2007
    • Buzzword, amazing...
    • Garbage collection of the Flash Player
    • October, 2007
    • Flash Player memory differences per browser
    • Zend Neon
    • Flex Builder for Linux
    • September, 2007
    • Testing the existance of an attribute in XML with AS3
    • Opening Flash documents within Flex
    • PDT 1.0 Released
    • EU vs Microsoft
    • August, 2007
    • Repent has a brand new website
    • Manipulating XML with namespace in AS3
    • What's going on with MXNA?
    • Red5 Admin Panel's future
    • July, 2007
    • Red5 Admin Panel 0.2 release (update)
    • June, 2007
    • Red5 Admin Panel 0.1
    • BabbaVideo: A new dutch Video site
    • Safari on Windows
    • Adobe Flex 3 and AIR
    • Adobe Live 2007
    • May, 2007
    • Tommorow Adobe Live
    • Strange Windows bug
    • April, 2007
    • The dark side of Flash
    • March, 2007
    • BlueBerry needs a Flex Developer
    • Apollo server, hmm what is that
    • February, 2007
    • Why (especially Adobe) and other companies should support Linux
    • Flex/Eclipse plugin idea
    • January, 2007
    • PHPEclipse is out, welcome PDT
    • Linux Flash Player 9 released
    • I Welcome all you MXNA readers
    • FullScreen and wMode
    • FLV Player in Flex
    • December, 2006
    • Dell Support rocks
    • November, 2006
    • Flash Media Server 3, and more
    • October, 2006
    • XS4ALL trouble
    • BlueChat, Flash Media Server Application
    • September, 2006
    • Flex Google calender
    • Skinning v2 components
    • Flash Media Server Application and advanced skinning
    • August, 2006
    • I finally discovered JSFL
    • You know sIFR?
    • PHP IDE
    • Datagrid experiences
    • July, 2006
    • My weblog is born
    show all
All rights reserved | Design and Development by Martijn van Beek | Managed by Flexibility | Photography by Kristel van Beek

You have Flash Player version: (click to check if you got the latest)
Adobe feeds | LinkedIn profile | Last.fm profile | Github