Friday, February 25, 2011

myBlog[2].newPost("Coding to get the grade");

There are a few things most programming professors expect in the code that is handed in to them.  In my experience professors like code that is clean, well commented, and has no tab damage as well as anything that is required by the college, such as an honor pledge.  Obviously another thing professors like is code that compiles and does what is required for the assignment.

Writing well commented code is a must, especially when you get into programming in a team of programmers.  A general rule is that if it was at all hard for you to write, comment it.  I recently got a job developing in C#.  I came in on a project and there were no comments at all, for any of the code.  As such, it took me about twice as long to read though the code and try to understand it.  As far as school goes, I've had professors say they will not grade an assignment if there are no comments and that about 15% if your grade on said assignment was for good comments and clean code.

I've had one professor that would dock points for tab damage.  What is tab damage you ask?  Tab damage is when you use tabs instead of spaces to indent your code.  All text editors handle tabs differently.  Some of them will set a tab to be equal to 5 spaces, or 3 spaces, or 7 spaces etc.  Say you are writing code in a text editor where a tab is only 3 spaces, and your professor opens your code in a text editor where a tab is 7 spaces.  In your professors text editor your code will look terrible because of the giant indents.  A way to avoid this is to set a tab in your text editor to insert a give number of spaces instead of a tab character.  All text editors treat spaces the same, so no damage from tab characters.  Some professors care about this and some don’t.  Also most IDE’s will take care of this for you.

Honor Pledges.  Make sure they are there if your professor is requiring one.  These basically say “I didn’t steal this code in whole or in part”.  This keeps students from cheating on their assignments.  Worried about collaborating with other students or friends?  Usually the college will have a policy on this, and have an area in the honor pledge to put who you worked with.  There is nothing worse than working on an assignment and then getting a 0 because you forgot to include the honor pledge in your code.

Code that compiles is a must as well.  If you are having trouble, don’t be afraid to ask your professor to point you in the right direction.  They are there to help you.  Another thing to watch out for is if you comment your code once you are done (you should really be doing it as you code) make sure your code compiles and runs after you make comments.  Never know, you might have accidentally deleted a semi-colon, or forgot a /.

A lot of what I just talked about is dependent on your professor, and how strict they are, but if you plan on getting a job programming you should take hold of good programming practices.  As I’ve heard, write your code as if the person that will be reading it is a crazy psychopath that knows where you live.

Happy programming!

31 comments:

  1. Never did C much in school but looking into it anyways.

    ReplyDelete
  2. I thought most schools teach java now?

    ReplyDelete
  3. Interesting read for someone that doesn't know shit about programming but has always wanted to get into it.

    ReplyDelete
  4. @2nd_lawl: My school teaches java. I learned c# on my own, and ended up getting a job doing .NET development.

    ReplyDelete
  5. Pretty interesting stuff. I know nothing about programming but this article was a good read :)

    ReplyDelete
  6. im very into this sort of stuff ... even though i only realy know about Css and HTML would love to start learning C# but i dont have the time :(

    ReplyDelete
  7. i really want to get into programming. thanks for the infos

    ReplyDelete
  8. programming, is so boring but really good to know

    ReplyDelete
  9. I wouldnt mind learning to program one day.

    ReplyDelete
  10. @YoamGary: I started off doing HTML and CSS. Then I though. I wanna take some information and store it somewhere and then use it later. How do I do that? Then picked up C# and .NET. I might post some examples sometime in the future.

    ReplyDelete
  11. we stole code, shared it, and passed it around. One project I turned in with a bunch of insults for comments - I got an A anyway. We had lazy profs.

    ReplyDelete
  12. I tried doing programming, you programmers are smart people, haha. Not an easy field.

    ReplyDelete
  13. i never did any coding in school but now i have to learn it for my course.

    ReplyDelete
  14. I am also starting to learn. I'm in electrical eng. and I have to learn, it's really interesting and rewardindg. Nice blog, following!

    ReplyDelete
  15. Tell me your secrets ;) I wonder how you programmers do so well, it seems like you're robots that type out line by line of various text. I can barely even remember how to make a simple webpage with HTML!

    ReplyDelete
  16. I use JAVA at school. I have a hard time picking what to comment; thanks!

    ReplyDelete
  17. I've been meaning to learn a bit of C#, but to be honest I consider it intimidating. But with any language I use, no matter how large or small it may be, I comment as if my life depends on it. I've found it to be greatly helpful. I just wish more advanced programmers who release source code would do the same.

    In remarks to your comment yes, I would absolutely recommend Mint over Ubuntu. It uses Ubuntu repositories mostly, for software, but also has its own. It also has, in my opinion, a much better update manager, and a much cleaner aesthetic.

    ReplyDelete
  18. I didn't know they were so strict these days.

    ReplyDelete
  19. I agree, there's nothing worse than working on a project and other people aren't commented code, makes things so tedious.

    ReplyDelete
  20. I got into very basic programming in high school and would love to continue it.

    ReplyDelete
  21. Thanks for the post, sorta gives me a "head start"

    ReplyDelete
  22. did I ever tell you that your blog titles are amazing XD

    ReplyDelete
  23. im having a hard time understanding all of this...hopefully the more I read the easier it will become

    ReplyDelete
  24. build me a website nao. I wanna do nothing but lame content revolving around advertising

    ReplyDelete
  25. good advice. commenting code is important.

    ReplyDelete
  26. I keep being reminded about comment lines but sometimes they just slip my mind. Great post.

    ReplyDelete
  27. Holy shit, your professor is an idiot. If he doesn't like how his editor displays tabs, then he should fix his damn editor to his liking. Indenting is the purpose of the tab character and has been since its invention. Do you see Ken Thompson "indenting" with spaces? Nope.

    6/10. Would mildly rage again.

    ReplyDelete
  28. very interesting, nice post

    + followed:)

    ReplyDelete