- Using tabs instead of spaces
- Not using CamelCase. ( this_is_my_var_name_is_better_readable_and_easier_to_write )
- using extra lines for the brakets:
Code: Select all
if ($foo)
{
echo "foo";
}
else
{
echo "bar";
}
Code: Select all
if ($foo)
{
echo "foo";
}
else
{
echo "bar";
}
What does this contribute to the discussion? I'm sure everyone here has their own favourites. But everyone naming them is not going to help us find a compromise. Do you have any suggestions for that?Dr.Death wrote:My favorites are:
So do you want to lock this topic?naderman wrote:Either way I think rather than discussing this any further we should focus on something more productive.
Well the way it's in the coding guidelines and the way it has been handled in Olympus is that you use tabs for indentation and formatting. The formatting part requires you to set your tab width to 4 for it to look properly. It still looks ok with settings like 2 or 4, but usually doesn't align properly. Of course it then becomes questionnable whether you should use tabs if you require them to be represented by a particular amount of spaces. People seem to prefer editing with tabs however and as you said mixing tabs & spaces that way requires a lot of discipline so I think we can just go on the way it was in Olympus.code reader wrote:two things:
1) tabs vs. spaces:
if you want to use tabs, it requires discipline, especially when you need to break a long line for readability:
e.g., let's say you have a line that looks like so:such a line needs to be broken.Code: Select all
'TAB_TAB'if (($some variable_with a long_name > 3 && $some variable_with a long_name < 17 && $today_is _tueseday) || $next_week_i_will_get_my_annual_bonus || $your_name == "AL")
when breaking it, you should *not* use:but rather:Code: Select all
'TAB_TAB'if (($some variable_with a long_name > 3 && $some variable_with a long_name < 17 && $today_is _tueseday) || 'TAB_TAB_TAB'$next_week_i_will_get_my_annual_bonus || $your_name == "AL")
(i used _ to denote space)Code: Select all
'TAB_TAB'if (($some variable_with a long_name > 3 && $some variable_with a long_name < 17 && $today_is _tueseday) || 'TAB_TAB'"___"$next_week_i_will_get_my_annual_bonus || $your_name == "AL")
in other words: <TAB> for indetation, and <sp> for tabulation when breaking long lines, otherwise things are completely messed when breaking long lines and different people use different TAB value.
since it isn't reasonable to expect coders to use this much discipline, it makes sense to avoid tabs altogether (of course, if long lines are never broken my argument is void, but this present even worse issues of readability)
Okay... so at the risk of possibly dragging this on...naderman wrote:No I don't, I'm just saying I don't think we should drag this on for everIf there are any new arguments or ideas how to compromise or some such I'd be happy to hear them.
Even with proper indentation it's still easy to do.code reader wrote:as to the case of adding a second statement to a block and forgetting to add braces:
this can only happen if one is sloppy with indentation, which is a mortal sin and is much more important than the question of braces/no braces.
SPL isn't a framework, it's a library.Nelsaidi wrote:I'm not too sure on SPL [...]
Not a fan of Kohana's naming or design.Nelsaidi wrote:[...] Kohana then underscores [...]