View Single Post
Old 01-06-2008, 01:22 PM   #2 (permalink)
Karl
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Great article, one note though, there's a better, cleaner (in my opinion) way to embed PHP into HTML, and that is using keywords in replace of brackets, such as:

PHP Code:

<?php if ($condition == 'value') : ?>

    <input type=”text” name=”<?php echo $name?>” />

<?php endif; ?>
Each to their own, I just prefer this way and thought it deserved a mention.

Finally, I have one more suggestion :)

1) Keep functions short and concise, with descriptive function names. This improves code clarity (cohesiveness), there's nothing worse than looking at a function that is responsible for 10 different little tasks, break that function up into smaller, more understandable functions.

Of course we're treading onto refactoring here, but imo that's an important part of clean code.
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

Last edited by Salathe : 01-06-2008 at 11:06 PM. Reason: I'm fairly sure you wanted a comparison operator (==) and a closing quote after 'value'... :)
Karl is offline  
Reply With Quote