Well, this is a discussion thread.
I just wanted to ask coders how they write their code, etc.
(of any programing language)
First of all I found that experienced devs tries to void curly brackets.
I mean I find it more easy to read when the code is
notPHP Code:if ($something)
{
if ($anything)
{
if ($whatsoever)
{
$var = "sumthing";
**
else
{
$var = "nothing1";
**
**
else
{
$var = "nothing2";
**
**
else
{
$var = "nothing3";
**
even if the statement does 1 thing, but it's far more easier to read and to extend the clauses in the future.PHP Code:if ($something)
if ($anything)
if ($whatsoever)
$var = "sumthing";
else
$var = "nothing1";
else
$var = "nothing2";
else
$var = "nothing3";
Is there any reason for that? I mean maybe devs try to make the code compatible with legacy versions of particular language or so.. Or is it just personal preference?
The next thing is that I am quite criticized among my course mates in the univ. that I use long variables. But I found it quite helpful to make sense of vars with the scheme
$root_branch_attribute.
e.g.
instead of using vars that does not make sense until you inspect all the codePHP Code:$server_css_body = "<link rel='stylesheet' href='body.css' />";
$server_css_global = "<link rel='stylesheet' href='global.css' />";
I would like to know what is your attitude towards such aspects of writing code?PHP Code:$css1 = "<link rel='stylesheet' href='body.css' />";
$css2 = "<link rel='stylesheet' href='global.css' />";
