Raised This Month: $51 Target: $400
 12% 

[TUT] Code Styling & Good Programming Habits


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-16-2010 , 21:00   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #51

Indeed.
__________________
Arkshine is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 01-16-2010 , 22:29   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #52

Quote:
Originally Posted by minimiller View Post
wtf pages!?!
u using ms word or some shit?
Yeah, lets start replying posts without using our brains first.

Quote:
Originally Posted by Bugsy View Post
Seriously... I don't think "number of lines you can see on a page" should be a deciding factor for the format of code.
Is not the number of lines, is more to fit a function, logical block, atom, piece-of-code-that-does-one-delimited-action, whatever you call it, in one page/screen.

Quote:
Originally Posted by ehha View Post
Here's why I agree on this, if you wanna do a quick eye search on a code block, it's just a vertical swoop & you're done.
When I started programming I used your "Nice" style, because it used to make my life easier when I was reading some code. But when I acquired some experience with programming, identifying block starts and block ends became so natural that the lone opening bracket lost its meaning for me. If you guys think ANSI styling is better, then use it, I'm only justifying why I prefer to use K&R styling.
Seta00 is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 01-16-2010 , 22:32   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #53

This post is one of the best formulated answers I've ever seen on styling guidelines.
Seta00 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-16-2010 , 22:33   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #54

Quote:
Originally Posted by Seta00 View Post
to fit a function, logical block, atom, piece-of-code-that-does-one-delimited-action, whatever you call it, in one page/screen.
You just repeated yourself. I most definitely agree with Bugsy. If I need the code to fit on one screen I make my screen bigger .
__________________
fysiks is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-17-2010 , 05:40   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #55

Quote:
When I started programming I used your "Nice" style, because it used to make my life easier when I was reading some code. But when I acquired some experience with programming, identifying block starts and block ends became so natural that the lone opening bracket lost its meaning for me. If you guys think ANSI styling is better, then use it, I'm only justifying why I prefer to use K&R styling.
You miss the point that you are on a public forum where 98% users are not pro-coder like you. It would be more appropriate to keep 'here' a style which 'enhance the clarity' so the users can read more easily the code, especially for the beginner.
__________________

Last edited by Arkshine; 01-17-2010 at 05:46.
Arkshine is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 01-17-2010 , 06:22   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #56

Also, to make logical blocks fit better in the page I recommend:


PHP Code:
if(something){    stuff();    things();    moreStuff();    } 
Because the resolution of the screen has proportions close to those of a square so it's better to use the full width.
joaquimandrade is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 01-18-2010 , 02:07   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #57

Joaquim, is that a joke?
__________________
stupok is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 01-18-2010 , 02:10   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #58

Quote:
Originally Posted by stupok View Post
Joaquim, is that a joke?
Yes. It was directed to:

Quote:
Originally Posted by Seta00 View Post
... and the new lines before every block allow for less code to fit in one page.
joaquimandrade is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 01-18-2010 , 12:23   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #59

People still don't understand what I mean. The space I save using K&R indentation is filled with COMMENTS. No matter how good your code is indented, no matter how many lines you put between the logical blocks, if your code isn't commented, it's fucking harder to understand it.
Seta00 is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 01-18-2010 , 12:51   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #60

Quote:
Originally Posted by Seta00 View Post
People still don't understand what I mean. The space I save using K&R indentation is filled with COMMENTS. No matter how good your code is indented, no matter how many lines you put between the logical blocks, if your code isn't commented, it's fucking harder to understand it.
And what that has to do with using an opening bracket in one extra line?

What i'm more compelled to believe is that you think that just because K&R are experts in programming, their style must be the best.

Last edited by joaquimandrade; 01-18-2010 at 12:53.
joaquimandrade is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode