How About An Actual Code Review?

A Member? Please Login  
type your username and password to login
Date: December 05, 2008, 06:07 PM
268562 members and 165654 Topics
Latest Member: qauseem
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Webmasters (Moderator: OmniPotens)  |  How About An Actual Code Review?
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: How About An Actual Code Review?  (Read 95 views)
my2cents (m)
How About An Actual Code Review?
« on: March 09, 2008, 10:33 PM »

So,

Every now and then, one of us will post a website for review.  For the most part, it has always centered on the actual UI - "colors out of whack" or "the header is inconsistent here and there".  That's all fine and dandy.  I am probably one of the few who actually will go as far as view the source to see what lied underneath.   So I began to think, "why not we do actual code reviews where we look at our css, php, html, javascript, etc?"  Sure, in the end, the site works and we got paid.  Having said that, there are efficient ways to write code.

The aim of this isn't to say, "your code sucks" but to advise on what is more efficient and why it is so.  I think we can all learn from this.  An example: I see many CSS sripts with:
padding-left: 22px; padding-right: 10px; padding-top: 4px; padding-bottom: 10px;

It's all good but such code could be compacted (thereby saving some bandwidth, among other reasons) via the T(op) R(ight) B(ottom) L(eft) (TRouBLe for short) technique into one line like so: padding: 4px 10px 10px 22px.  Even better, if all 4 attributes are the same, we could tighten it even more like so: padding: 10px 10px; (Top and Bottom: 10px, Left and Right: 10px).

Again I think we can all learn from this.  Other than the back-end languages, no one needs to copy and paste their code as it can be easily made available via "view source".

What do you all think?
prodgalson
Re: How About An Actual Code Review?
« #1 on: March 11, 2008, 02:34 AM »

I think its a great idea,  Helping people to get rid of bad coding habits will get us all at best practices sooner than later.  The only thing I see in the way of achieving that goal is that a lot of people don't write their own code: they use WYSIWYG editors or, at best, copy and paste code from other sites.
my2cents (m)
Re: How About An Actual Code Review?
« #2 on: March 11, 2008, 11:22 AM »

Quote
The only thing I see in the way of achieving that goal is that a lot of people don't write their own code: they use WYSIWYG editors or, at best, copy and paste code from other sites.
Prodgal,

You know, I never thought of that.  However, I still think it is possible - there are things that WYSIWYGs do (like include scripts inline on a page as opposed to in a .js file, for example) that we could advise against.  Here's an example:  Someone posted for review a website with a cool script I ended up using for a recent project of mine.  I viewed source and found that it came from Dynamic Drive.  I however didn't paste the code inline in my file.  Rather, I copied it, pasted it in a .js file and included that file on my pages, thus separating the script from the presentation.  In other words, if I had pasted the same code on 5 pages, it would have been a nightmare to maintain.

Your points have been well noted.  I still think though that it is possible.  Or at least, let's give it a try.
 Velnetweb.co.uk Coupon For March, 20% Discount!  Web Graphics Guy Needed  Yahoo And Myspace Join With Google  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Job Talk Jobs/Vacancies (2) Career Talk Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.