Closed Thread
Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: Coding style.

  1. #21
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: Coding style.

    I try to make my code as spaced out and clear as possible. I group things together that are similar, and leave lots of space between items which I need to update frequently.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #22
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: Coding style.

    I adhere to the PEAR conventions.

  4. #23
    nexus-6's Avatar
    nexus-6 is offline Newbie
    Join Date
    Mar 2009
    Posts
    14
    Rep Power
    0

    Re: Coding style.

    As far as i'm concerned, all code should be readable from beginning to end.. i tend to space out every new section/loop further to make it standout more.
    Also i like to leave a lot of comments in the source to explain what each section should be doing or what choices lead to what section, including which variables to set beforehand to let it funktion proper. This has saved me several times from fatal errors.

  5. #24
    Phoenixz is offline Programming Professional
    Join Date
    Dec 2008
    Posts
    256
    Blog Entries
    1
    Rep Power
    13

    Re: Coding style.

    I just use the way in which I think looks the most elegant. Not too much white space, but enough to make it look nice.

    Edit: I remember a long time ago I used to code in one line only. very messy

  6. #25
    Join Date
    Aug 2007
    Location
    Gizeh, Al Jizah, Egypt, Egypt
    Posts
    8,675
    Blog Entries
    12
    Rep Power
    81

    Re: Coding style.

    i make my JS very un-readable to confuse my friends who cheat my home work
    yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
    Code:
    eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
    www.amrosama.com | the unholy methods of javascript

  7. #26
    Join Date
    Oct 2007
    Posts
    538
    Rep Power
    21

    Re: Coding style.

    Quote Originally Posted by nexus-6 View Post
    As far as i'm concerned, all code should be readable from beginning to end.. i tend to space out every new section/loop further to make it standout more.
    Also i like to leave a lot of comments in the source to explain what each section should be doing or what choices lead to what section, including which variables to set beforehand to let it funktion proper. This has saved me several times from fatal errors.

    I'm sceptical about comments. I always ask if I am about to write a comment can I instead change the code to make it clearer.

    For my purposes I want comments to be something a person reads. When you see a comment in my code you know it isn't just there for reference. You'd better **** read it or otherwise you will be feeling pain at some point. I tend to explain strange implementation decisions and why they actually make sense and you should not do the 'obvious' thing.

    For example I had one person rewrite my SSE assembly code to 'make it clearer'. I had for some bizarre reason intermixed several distinct sections of code to make it near unreadable. Of course there was a perfectly good comment explaining that modern CPUs take many cycles to load from memory to a register but can perform calculations on other registers while this is loading. So in my matrix/vector multiplication code I was loading the next column of the matrix in before multiplying the current column. That way by the time the nth multiplication was done the n+1 column was already loaded. Doing it the obvious way made the code take 4 times as long.

    I find things that state why something is done are more important that telling me what you are doing. After all I know what you are doing, the code tells me as much.

Closed Thread
Page 3 of 3 FirstFirst 123

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. p style border help!
    By j.lai in forum HTML Programming
    Replies: 5
    Last Post: 06-07-2010, 06:54 AM
  2. SEO - Google Style
    By BlaineSch in forum Search Engine Optimization
    Replies: 6
    Last Post: 07-28-2009, 01:03 AM
  3. How to change the style of the form ?
    By kresh7 in forum Visual Basic Programming
    Replies: 84
    Last Post: 08-17-2008, 06:18 PM
  4. Html with style
    By priorityone in forum HTML Programming
    Replies: 5
    Last Post: 01-29-2007, 08:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

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