Lists

It’s as simple as 1, 2, 3…

5 Programming Rules You Should Already Know

Posted by Fibonacci on August 9, 2008

It never hurts to remind you these small recipes aimed at programming novices:

1. Keep it simple. As in everything in life there are many ways to solve the same problem, but not like in life, in programming it is better to choose the simplest solution. The benefits of that are: code maintainability, easy to explain to others, easy to understand what you did with your code months ago.

2. Use design patterns. Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems, and it also improves code readability for coders and architects who are familiar with the patterns.

3. Comments. If in order to understand one’s code is has to be as green as Hulk, he probably didn’t follow the first tip. In many cases more self explanatory variables will do the trick and keep the code on a readable level. There are times when comments serve a purpose though. Algorithms can be hard to grasp and yet impossible to simplify through further abstractions. In such cases, you can explain yourself with comments. The rule of thumb for a good comment – it has to be an answer to “Why?” rather than “What?”.

4. High cohesion and Low coupling. Assign responsibility so that coupling remains low and cohesion high. Coupling is a measure of how strongly one element is connected to, has knowledge of, or relies on other elements. An element with low (or weak) coupling is not dependent on too many other elements. Cohesion is a measure of how strictly related and focused the responsibilities of an element are. An element with highly related responsibilities and which does not do a tremendous amount of work has high cohesion.

5. Don’t write deeply nested code. Nested code is code containing case/if/receive statements within other case/if/receive statements. It is bad programming style to write deeply nested code – the code has a tendency to drift across the page to the right and soon becomes unreadable. Try to limit most of your code to a maximum of two levels of indentation. This can be achieved by dividing the code into shorter functions.

I would like to hear from you about your experience and other tips.

48 Responses to “5 Programming Rules You Should Already Know”

  1. Salon1 said

    Good post. From a Systems Engineering perspective, comments are often underratted and essential. I like the “why” emphasis you suggested. However, I believe a goal a programmer should always be striving for is to write their code such that comments are not neccessary (e.g., self-explanatory variable names, etc.). Another pet peave I have related to point 1 is programmers that try to see how much functionality they can put in a single line or statement as a demonstration of their ability. This also makes it hard to debug and very hard to modify. I would rather see a single simple straight forward execution per line.

  2. I love your site!

    _____________________
    Experiencing a slow PC recently? Fix it now!

  3. […] found on a website 5 programming rules, which I share with […]

  4. I would actually go with salon1 here… comments are important in a major project

  5. Once even more studying any piece of writing, and additionally dealing with it again having my friend, I have hit in to the suitable final result that your chosen feeling is undoubtedly, in actual fact, incorrect. Rose bushes, a projects anyone submitted in an individual’s textual content, are the most beneficial projects on the planet. Maybe you’ve received all roses actually that you saw, perhaps you have had smelled some Went up by, or simply smelled came about in Bulgaria. Zero! I did not view you own! Well listen, because you never have, don’t have fun them.

  6. Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is magnificent, let alone the content! que es el acne

  7. Angkor said

    ytEGKUuJ Buy Ambien

  8. 1 comment for line no even space untill comments and comments…. Your comment about something, i suggest too be it more long as possible Ur1: hxxp://yourwebsitecom (don’t even use the stadard format or you will be detected from anti-spam)

  9. nosfer323 said

    nice one

  10. That is a great article!

  11. Hi thanks for information ,actually I’m looking for this information I’m facing some problem related to this matter.

  12. cheersy, I totally love this blog and I only wanna say thank you for this website

  13. Very good blog! Do you have any suggestions for aspiring writers? I’m planning to start my own site soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally overwhelmed .. Any ideas? Thank you!

  14. Hey great article man it helped me a lot !

  15. I wanted to post you that tiny remark to say thanks a lot over again just for the nice secrets you have featured in this case. It was really seriously open-handed with you to grant publicly just what many individuals might have offered for an ebook to generate some dough for themselves, mostly now that you might have tried it in case you desired. These secrets as well served to be a good way to fully grasp that other people online have the identical fervor much like my personal own to know the truth more regarding this matter.

  16. I really need to look into this more, thanks for article.

  17. Title…

    This is my Excerpt…

  18. Ebo Ndut said

    Ebo Ndut What would happen if he only sucked a few drops for example? What about if he was thirsty and drank a whole pint? Would Dracula die or would he be saved? How much blood would it take to turn Dracula into a little angel?…

    in Bram Stoker’s Dracula? If you’re not gonna help then don’t bother… I didn’t finish the book in time and I have an essay to write now. Thanks so much for your help :)…

  19. http://184.154.132.242/~coltsdig/index.php?action=profile;u=73003

  20. all gooooooooooooooooood

  21. Thanks for giving your ideas listed here. The other thing is that each time a problem appears with a personal computer motherboard, people today should not consider the risk regarding repairing this themselves because if it is not done correctly it can lead to permanent damage to all the laptop. It is almost always safe just to approach a dealer of that laptop for your repair of motherboard. They’ve technicians that have an competence in dealing with laptop computer motherboard troubles and can carry out the right analysis and carry out repairs.

  22. articlesblog said

    Finally I Have found the necessary info! Even the Ukrainian students prefer to read the blogs, based on WordPress, because it opens the mobile opportunities. Though while the reading this post in Opera mobile I have noticed that the blog structure was not strict as from PC it is � please check !

  23. articlesblog said

    Lviv (Ukraine), students want to read your blog – it helps to smile when we are in college study trip through the pages of the blog ! The only question – is the graphics … is not so vivid mobile gadgets

  24. Great goods from you, man. 5 Programming Rules You Should Already Know Lists I have understand your stuff previous to and you’re just too magnificent. I actually like what you’ve acquired here, certainly like what you are saying and the way in which you say it. You make it enjoyable and you still take care of to keep it smart. I can’t wait to read far more from you. This is really a great 5 Programming Rules You Should Already Know Lists informations.

  25. http://loadcentralph.net – Your 1-stop reloading station. Buying eload has not been this easy!

  26. 5 Programming Rules You Should Already Know Lists I was recommended this website by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my trouble. You are amazing! Thanks! your article about 5 Programming Rules You Should Already Know Lists Best Regards Nick Rolf

  27. Hi, I visited yor article in SEO reason, I confess, but I found quite interesting content. Thanks a lot !

  28. Even in serious conditions, a herniated disc for example, the anguish can and often will go away without treatment, due to the proper care and therapy.
    Improving strength and adaptability go hand in hand. The exercises are designed to reduce
    low back pain and increase circulation.

  29. A herniated disc is a bit more serious than the usual bulging disc
    as the outer layer with the disc has actually ruptured.
    Their can be an investment of their time and effort
    required. This way is done by using an especially designed apparatus.

  30. In just a couple of minutes, it provides relief from a throbbing headache.
    The syndrome is situated one or two weeks before menstruation after which declining if
    the period starts. Tyramine: it is a compound
    that is certainly suspected of causing headaches in certain people.

  31. People with adrenal fatigue often have low blood
    pressure. either as a result of move or a change in the household or because no routine may be successfully established.
    Sport celebrities imagine themselves hitting that home run, making that hole a single, or finishing
    first.

  32. Rene said

    Your facebook like module is busted, at least it’s not on my end. Doesn’t seem to work regardless of what I do.
    Wanted to provide you with a like, but I can’t. Sorry. Outstanding content though, definitely worth a bookmark.

  33. I almost never drop responses, however after reading through a
    great deal of remarks here 5 Programming Rules You Should Already
    Know Lists. I do have a couple of questions for you if you do not mind.

    Is it only me or does it look as if like some of the responses come across like they
    are written by brain dead individuals?😛 And, if you are posting at other social sites, I’d like to follow you. Could you make a list of every one of all your social community pages like your Facebook page, twitter feed, or linkedin profile?

  34. But how are you affected if Candida spreads to the rest with the body and becomes systemic.
    There are many treatment plans out there for Candida , however
    , nearly as many as 95% aren’t treating the foundation cause that’s permitting Candida to prosper with your body. Candida albicans gets a crisis mainly because it starts to excessively grow and spread while it’ll result in agonizing and discomforting symptoms and symptoms of a infection of yeast.

  35. She will acquire consciousness of her extroverted side, and it’ll belong to her human conscience. These derailments usually occur because of trauma, parental neglect or abuse. This is starting to become very alarming not merely because the numbers have been soaring high but more to the point, the ones that are being impacted are far too young than expected.

  36. Everything is very open with a very clear explanation of the challenges.
    It was definitely informative. Your site is useful.
    Thanks for sharing!

  37. Whats up very nice web site!! Man .. Beautiful .. Wonderful .
    . I’ll bookmark your website and take the feeds also? I am happy to seek out numerous useful info here in the post, we’d like develop more strategies in this regard, thanks for sharing.
    . . . . .

  38. candidoza said

    Hi there i am kavin, its my first time to commenting anywhere, when
    i read this paragraph i thought i could also make comment due to this sensible piece of writing.

  39. WOW just what I was searching for. Came here by searching for best coupon codes

  40. What i do not realize is actually how you are no longer actually much
    more smartly-liked than you might be right now. You are very intelligent.
    You already know therefore considerably in relation to this subject, produced me individually believe it
    from a lot of varied angles. Its like men and women aren’t fascinated except it is one thing to do with Girl gaga! Your individual stuffs great. At all times care for it up!

  41. To get some real relief it is suggested that you use one clove
    or tab as a suppository every couple of hours until you
    get some relief from the symptoms, just remember to wear a pad.
    Pau D’arco (Tabebuia); salve effective against Candida(8), or drink
    two cups of tea daily for two weeks plus finger or sitz baths.
    Probiotics, such as lactobacillus and acidophilus, are healthy strains
    of bacteria that have a beneficial and symbiotic relationship with the body, especially in the gastrointestinal tract.

  42. Cristina said

    s a negative side to the interest in digital content, and that.
    Instant availability is what’s triggering ebook piracy too. We’ll start our tour
    at Marina Grande on the north shore of the island,
    about one third in the way in looking at the easternmost point.

  43. What’s up, all is going sound here and ofcourse every one is sharing information, that’s genuinely excellent, keep up writing.

  44. Pirate Bay said

    Back then, files were shared by “sneaker-net” where users physically gave the floppy
    disk while using files to become shared towards the other
    party. At their utmost they produce moments that produce life
    worth living. However, every travelers in India, Indian or of foreign origin , would prosper to plan his trip upfront
    to enable him to locate a hotel bid that many suits his needs.

  45. Hi there would you mind letting me know which webhost
    you’re utilizing? I’ve loaded your blog in 3 different web browsers and I must
    say this blog loads a lot quicker then most.
    Can you recommend a good internet hosting provider at
    a reasonable price? Kudos, I appreciate it!

  46. I don’t even know the way I ended up right here, however I believed this put up was once good. I don’t recognize who you are but certainly you’re going to a famous blogger if you happen to aren’t already. Cheers!

  47. Gamer50 said

    Buy like a couple of toys, I can tell unequivocally say I am satisfied with the purchase, I advise everyone to book acquire program only in the London firm. Orders are processed faster than I thought, management polite and responsive, in general, all good.)) That’s referring to the site where I found this shop, who can then also want: http://www.areatest.ru/

  48. Eduardmag said

    Welcome to http://www.magnetik.com.ua

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: