home support FAQ resources services partners contact us contact us
 Web Application Previous  Next  
 Tutorial

Notice that this piece of code has fewer difficulties to navigate.
The use of spaces in the snippet can be exaggerated even more by also separating
parentheses from keywords:

<?
function myfunc ( $myvar )
{
$somevar = $myvar * 2;
return ( $somevar + 1 );
}
print ( myfunc ( 1 ) );
?>
It may seem somewhat excessive here, but imagine this code embedded into a few
thousand other lines of code, and you might change your opinion. Some people say
that the spaces between parentheses are more disturbing and irritating than helpful in
structuring the text—we must confess that sometimes that’s true.The examples in this
book don’t always use this kind of formatting; we’re leaving the decision to you as to
whether to use this method.The most important thing is this: Be consistent. Once
you’ve decided to use a certain style, keep it at least throughout a project. If you’re
modifying other people’s sources, follow their style as well as you can. Consistency is
one of the most important aspects in professional development.
Try reading all example sources attentively and then try to imitate their style, adapting
your own style until you’ve reached something very close to the original. As soon
as you’re feeling familiar with it, you’ll see that it wasn’t a worthless effort.

12 Chapter 1 Development Concepts

To motivate you before going further, two examples.
The code in Figure 1.1 is meant to create an SQL statement. Except for the last
line assigning a string containing “select *” to a variable named $query, we don’t
think that anything in Figure 1.1 indicates the code’s purpose. In the code in Figure
1.2, on the other hand, it’s easy to understand what’s going on.
Previous  Next  
Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist