User tests: Successful: Unsuccessful:
Make it more simple and easy to read.
I don't think I like the last commit. It removes the instanceof
checks. Or do I miss something?
Edit: Found what I missed. Variables are already typehinted in the function declaration.
If we already have typehiting, we do not need to check again. This is redundant.
Yep, fully agree with this change.
Can you make a PR for 3.x also? ;)
I don't like this change. ternary conditionals have little to no expressive value and just make the code harder to learn.
Instead I would suggest:
if(is_null($input)
{
$input = new JInput();
}
$this->input = $input;
Expressive code is important to reducing the learning curve.
This code is very expressive imo. Additional conditionals only distract
from what is actually relevant.
On 26 Jul 2014 16:50, "Mathew Lenning" notifications@github.com wrote:
I don't like this change. ternary conditionals have little to no
expressive value and just make the code harder to learn.Instead I would suggest:
if(is_null($input)
{
$input = new JInput();
}
$this->input = $input;Expressive code is important to reducing the learning curve.
—
Reply to this email directly or view it on GitHub
#3943 (comment).
Ocramius, how long have you been coding?
When we program we should be thinking about the person that just heard about Joomla from a friend. They haven't read a single "Joomla" book and only googled PHP yesterday.
So read this outloud and tell me is it English? $this->input = $input ?: new JInput;
Make sure you read exactly what is written not the covered association that you gained through X Years of developer experience.
I read it as "This input equals input question mark colon new JInput." Is that English?
Now read my version
"If is null input, input equals new Jinput. This input equals input." That is what expressive code is about.
I am fairly sure about my previous statement.
On 26 Jul 2014 17:32, "Mathew Lenning" notifications@github.com wrote:
Ocramius, how long have you been coding?
When we program we should be thinking about the person that just heard
about Joomla from a friend. They haven't read a single "Joomla" book and
only googled PHP yesterday.So read this outloud and tell me is it English? $this->input = $input ?:
new JInput;
Make sure you read exactly what is written not the covered association
that you gained through X Years of developer experience.I read it as "This input equals input question mark colleen new JInput."
Is that English?Now read my version
"If is null input, input equals new Jinput. This input equals input." That
is what expressive code is about.—
Reply to this email directly or view it on GitHub
#3943 (comment).
How about keeping those comments? For example
// If a client object is given use it otherwise instantiate a new web client object.
$this->client = $client ?: new JWebClient;
The elvis operator has pretty much only one purpose, which is implemented
here ;-) I just don't see how any further clarification/comment could be
needed.
On 26 Jul 2014 18:51, "Achal-Aggarwal" notifications@github.com wrote:
How about keeping those comments? For example
// If a client object is given use it otherwise instantiate a new web client object.
$this->client = $client ?: new JWebClient;—
Reply to this email directly or view it on GitHub
#3943 (comment).
No argument here. If you already know that it is called an elvis operator good to go right.
If not, take your mind off learning the program and google "?:" to find out what the this means.
Sincerely,
Mathew Lenning
Babel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 2:20 AM, George Wilson notifications@github.com wrote:
@test works as expected. Please merge this and close the arguments
\
Reply to this email directly or view it on GitHub.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-07-26 23:34:06 |
And what about Joomla 3? ;)
Argh, Joomla is still on 5.2? :-(
2.5 is 5.2 and higher (which is the branch you PR'd to). 3.x is 5.3.10 and higher
Does this help illustrate why Elvis shouldn't be used in Joomla?
Wasting cognitive energy on making distinctions between PHP versions isn't going to make anyone's life easier.
I know some of you might think I'm just being a code snob, but these little things add up quickly.
For the sake of saving a few lines, you raise the learning curve substantially.
Program for people, not machines really has value in real world software development.
Sincerely,
Mathew Lenning
Babel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 5:57 PM, George Wilson notifications@github.com wrote:
2.5 is 5.2 and higher (which is the branch you PR'd to). 3.x is 5.3.10 and higher
\
Reply to this email directly or view it on GitHub.
@Matthew I'd rather say "code for this decade". It's a completely different
argument, can't do much if joomla keeps maintaining for dead horses.
The patch should still land in 3.x
Marco Pivetta
On 27 July 2014 11:41, Mathew Lenning notifications@github.com wrote:
Does this help illustrate why Elvis shouldn't be used in Joomla?
Wasting cognitive energy on making distinctions between PHP versions isn't
going to make anyone's life easier.I know some of you might think I'm just being a code snob, but these
little things add up quickly.For the sake of saving a few lines, you raise the learning curve
substantially.Program for people, not machines really has value in real world software
development.Sincerely,
Mathew LenningBabel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 5:57 PM, George Wilson notifications@github.com
wrote:2.5 is 5.2 and higher (which is the branch you PR'd to). 3.x is 5.3.10
and higher\
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub
#3943 (comment).
Code for this decade and it will be obsolete five years from now.
Clean expressive code is self evident. It withstands the test of time. When do you think they'll depreciate or change the IF statement behavior?
Sincerely,
Mathew Lenning
Babel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 6:43 PM, Marco Pivetta notifications@github.com wrote:
@Matthew I'd rather say "code for this decade". It's a completely different
argument, can't do much if joomla keeps maintaining for dead horses.The patch should still land in 3.x
Marco Pivetta
On 27 July 2014 11:41, Mathew Lenning notifications@github.com wrote:
Does this help illustrate why Elvis shouldn't be used in Joomla?
Wasting cognitive energy on making distinctions between PHP versions isn't
going to make anyone's life easier.I know some of you might think I'm just being a code snob, but these
little things add up quickly.For the sake of saving a few lines, you raise the learning curve
substantially.Program for people, not machines really has value in real world software
development.Sincerely,
Mathew LenningBabel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 5:57 PM, George Wilson notifications@github.com
wrote:2.5 is 5.2 and higher (which is the branch you PR'd to). 3.x is 5.3.10
and higher\
Reply to this email directly or view it on GitHub.\
Reply to this email directly or view it on GitHub
#3943 (comment).\
Reply to this email directly or view it on GitHub.
http://www.antiifcampaign.com/ :-)
Marco Pivetta
On 27 July 2014 12:39, Mathew Lenning notifications@github.com wrote:
Code for this decade and it will be obsolete five years from now.
Clean expressive code is self evident. It withstands the test of time.
When do you think they'll depreciate or change the IF statement behavior?Sincerely,
Mathew LenningBabel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 6:43 PM, Marco Pivetta notifications@github.com
wrote:@Matthew I'd rather say "code for this decade". It's a completely
different
argument, can't do much if joomla keeps maintaining for dead horses.The patch should still land in 3.x
Marco Pivetta
On 27 July 2014 11:41, Mathew Lenning notifications@github.com wrote:
Does this help illustrate why Elvis shouldn't be used in Joomla?
Wasting cognitive energy on making distinctions between PHP versions
isn't
going to make anyone's life easier.I know some of you might think I'm just being a code snob, but these
little things add up quickly.For the sake of saving a few lines, you raise the learning curve
substantially.Program for people, not machines really has value in real world
software
development.Sincerely,
Mathew LenningBabel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 5:57 PM, George Wilson notifications@github.com
wrote:
2.5 is 5.2 and higher (which is the branch you PR'd to). 3.x is
5.3.10
and higher\
Reply to this email directly or view it on GitHub.\
Reply to this email directly or view it on GitHub
#3943 (comment).\
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub
#3943 (comment).
Ok guys :) Too far off topic. Let's keep it to the code.
@David
Agreed. There is no point in arguing about an PR that had to be reverted anyway.
Happy Joomla!ng
Sincerely,
Mathew Lenning
Babel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Jul 27, 2014, at 7:47 PM, David Hurley notifications@github.com wrote:
Ok guys :) Too far off topic. Let's keep it to the code.
\
Reply to this email directly or view it on GitHub.
Big