
onehundredandtwo wrote:I don't like the CamelCase (instead of camel_case). The variable without camel-case looks a lot cleaner to me.
- Code: Select all
$my_var
$myVar
code reader wrote:the 2 things that irritate me about the phpbb coding style are:
-- the insistence of having a { and } even for a single statements, e.g. after "if", "while" etc.
-- giving the opening "{" its own line.
these two decisions were made originally "to improve readability", but it is a well established fact that in reality they reduce readability.
maybe the best evidence is python, which very few will deny is *more* readable than either C or perl, while doing away with "{" and "}" altogether.
"{" and "}" are "syntactical sugar" that meant to make the compiler's life easier, but help humans very little.
indentation is sacred and should be observed at all costs, but "{" and "}" are pure noise, as far as readability is concerned, and only serve to distract the reader (at least *this* code reader) from what's important: the content of the statements rather than their bracketing.




Steve McConnel wrote:In their classic paper Perception in Chess, Chase and Simon reported on a study that compared the abilities of experts and novices to remember the positions of pieces in chess. When pieces were arranged on the board as they might be during a game, the experts' memories were far superior to the novices'. When the pieces were arranged randomly, there was little difference between the memories of the experts and the novices. The traditional interpretation of this result is that an expert's memory is not inherently better than a novice's but that the expert has a knowledge structure that helps him or her remember particular kinds of information. When new information corresponds to the knowledge structure -- in this case, the sensible placement of chess pieces -- the expert can remember it easily. When new information doesn't correspond to a knowledge structure -- the chess pieces are randomly positioned -- the expert can't remember it any better than the novice.
A few years later, Ben Shneiderman duplicated Chase and Simon's results in the computer-programming arena and reported his results in a paper called Exploratory Experiments in Programmer Behavior. Shneiderman found that when program statements were arranged in a sensible order, experts were able to remember them better than novices. When statements were shuffled, the experts' superiority was reduced. Shneiderman's results have been confirmed in other studies. The basic concept has also been confirmed in the games Go and bridge and in electronics, music, and physics.
Jeff Atwood wrote:Choose tabs, choose spaces, choose whatever layout conventions make sense to you and your team. It doesn't actually matter which coding styles you pick. What does matter is that you, and everyone else on your team, sticks with those conventions and uses them consistently.
Hi Nils, have a question on this.naderman wrote:There is one reason in particular why always wrapping code in curly braces is a good idea: You will never accidentally add an unconditional statement that was meant to be conditional, because you need to add braces once you want to add a second statement inside the if. And as for the other part of your argument PHP has curly braces, we can't just "do away" with them, so we can as well use them consistently. Giving "{" its own line is really mostly an arbitrary choice, although I think it does improve readability, but just as well would a requirement for empty lines before and after long statement lists. I do not think it hinders readability however.
if ($something) call_foo(false); if ($something)
call_foo(false); if ($something)
call_foo(false);
else
call_bar(true); if ($something)
{
call_foo(false);
} if ($x > 3 && $x < 7) echo $x; $x = substr(foo($x), 5); What is the rational for switching from lowercase identifiers to CamelCase identifiers?

Users browsing this forum: No registered users and 1 guest