I personly prefer: method doit ($a, $b, $c) {... }
to method doit (::?CLASS $self: $a, $b, $c) {... }
But of course the other suits your "argument" better. But I don't see a problem with being explicit if you must for some reason and being able to e.g. change $self into $this.
My experience is that I'm much more likely to be able to understand someone's Java or Ruby code than anything on CPAN. That holds true even for bad Java code that throws up a zillion warnings in Eclipse/PMD.
CPAN is like Java library implementation. How often do you read that? Secondly my opinion is the reverse, Java is so verbose that I have to read 2-4 times more code in Java than in Perl, which is harder to remember. Also somebody who doesn't know to write Perl, usually writes as in shell and that is pretty simple. I prefer flexibility over simplicity, therefore Perl to Java.
But Perl is not very clean or structured. It's often hard to read. And that makes it a bad choice for large software engineering projects.
Not true! You can make bad code in any language. There are a lot of bad code written in Perl, but well there are several reason for this. Perl was one of the first languages to hit the net and therefore people without real knowledge wrote programs in it. The MVC kind of paradigms wasn't applied and so on. You can't compare Ruby on rails to 10 year old Perl programs, but you can easily compare something written in e.g. Catalyst to rails.
But how much pre-Perl6 code is already out there?
Some, not a lot ofcourse, but the point wasn't the amount of code, it was that the area has been getting atention in the last years. Use Moose or similar frameworks if you want clean OOP in Perl 5
Trying to use Perl for enterprise code just doesn't sound like the best use of that language.
If you say so it must be correct. Can you please tell Amazon and Yahoo that? I'm sure they would like to know. Also a lot of banks in London use Perl for critical parts of their operation, they will probably not too be happy about this, but if you say so...
Different programming paradigms have different uses, different ecosystems
You are correct! That's why Perl allows different ways of accomplishing the same thing. Sometimes one way is best other time another is better. The single mindedness of OOP right know is the reason why Java is soo verbose.
There's one big diifference, however: python is a well-designed, highly structured language. Perl sort of grew organically from a couple of scripting languages, and had OO pasted on later.
You can argue that Perl's OO is pasted on, which is somewhat true, but that doesn't mean that it isn't powerfull. Try Moose. Certainly OO is a thing being fixed in Perl6. Until that is available use Moose or try to realize that OOP isn't the only form of programming.
Saying indirectly that Perl5 isn't well designed, just pisses me off. It grew organically, but changed during these years and got refined. If you keep to best practises, Perl code can be as readable as any language and even better as it is more powerfull.
Re:Sometimes the correct answer is the simplest
on
Why Corporates Hate Perl
·
· Score: 5, Insightful
For example look at this
s!(?:^|\w*/|\.\./|\./)[^\s,@;:]*(?<=/)([^\s,@;:]+?)(?=[\s,@;:]|$)!$1!g;
But this "Perl" code is really a regular expression which is also used in PCRE and PHP and so on. Copied because it was the best there was.
To improve readability of a regex use best practise and use/x (with whitespace and comments) and stop confusing Perl and regex.
Sorry, but that is wrong. You return 0 when printf return less than 0. I would rather do this which is actually faster...
#include
int main(int argc, char * argv[]) {
return (printf("hello World!\n"));
}
Also I got a 14% speedup using -O3 instead of -02 which he used in the tests. The Java compiler is optimizing automatically so the C++ test should also be optimized as much as possible. So 15% from changing the code and almost 15% from optimizing.
I saw this test a few days ago and wanted to check it out. The first thing I realize is that the source code is somewhat different even if Java has almost the same syntax as C++.
I understand that System.out.println(); is not in C++ but why have
I made the C++ code look like Java and got a 15% save. Problably even more if I had increased the number you call the program with. I looked at some of the other program and they have different code in them as well. So this test is bullshit it only shows that you can make slow programs in any language.
I personly prefer: ... } ... }
method doit ($a, $b, $c) {
to
method doit (::?CLASS $self: $a, $b, $c) {
But of course the other suits your "argument" better. But I don't see a problem with being explicit if you must for some reason and being able to e.g. change $self into $this.
My experience is that I'm much more likely to be able to understand someone's Java or Ruby code than anything on CPAN. That holds true even for bad Java code that throws up a zillion warnings in Eclipse/PMD.
CPAN is like Java library implementation. How often do you read that? Secondly my opinion is the reverse, Java is so verbose that I have to read 2-4 times more code in Java than in Perl, which is harder to remember. Also somebody who doesn't know to write Perl, usually writes as in shell and that is pretty simple. I prefer flexibility over simplicity, therefore Perl to Java.
But Perl is not very clean or structured. It's often hard to read. And that makes it a bad choice for large software engineering projects.
Not true! You can make bad code in any language. There are a lot of bad code written in Perl, but well there are several reason for this. Perl was one of the first languages to hit the net and therefore people without real knowledge wrote programs in it. The MVC kind of paradigms wasn't applied and so on. You can't compare Ruby on rails to 10 year old Perl programs, but you can easily compare something written in e.g. Catalyst to rails.
But how much pre-Perl6 code is already out there?
Some, not a lot ofcourse, but the point wasn't the amount of code, it was that the area has been getting atention in the last years. Use Moose or similar frameworks if you want clean OOP in Perl 5
Trying to use Perl for enterprise code just doesn't sound like the best use of that language.
If you say so it must be correct. Can you please tell Amazon and Yahoo that? I'm sure they would like to know. Also a lot of banks in London use Perl for critical parts of their operation, they will probably not too be happy about this, but if you say so...
Different programming paradigms have different uses, different ecosystems
You are correct! That's why Perl allows different ways of accomplishing the same thing. Sometimes one way is best other time another is better. The single mindedness of OOP right know is the reason why Java is soo verbose.
There's one big diifference, however: python is a well-designed, highly structured language. Perl sort of grew organically from a couple of scripting languages, and had OO pasted on later.
You can argue that Perl's OO is pasted on, which is somewhat true, but that doesn't mean that it isn't powerfull. Try Moose. Certainly OO is a thing being fixed in Perl6. Until that is available use Moose or try to realize that OOP isn't the only form of programming.
Saying indirectly that Perl5 isn't well designed, just pisses me off. It grew organically, but changed during these years and got refined. If you keep to best practises, Perl code can be as readable as any language and even better as it is more powerfull.
For example look at this s!(?:^|\w*/|\.\./|\./)[^\s,@;:]*(?<=/)([^\s,@;:]+?)(?=[\s,@;:]|$)!$1!g;
But this "Perl" code is really a regular expression which is also used in PCRE and PHP and so on. Copied because it was the best there was.
To improve readability of a regex use best practise and use /x (with whitespace and comments) and stop confusing Perl and regex.
javascript != functional programming
n g
Checkout http://en.wikipedia.org/wiki/Functional_programmi
But I agree with you in that verbosity is out, but I would go for languages like Perl for quick writing and C++ (or C ) for performance
Sorry, but that is wrong. You return 0 when printf return less than 0. I would rather do this which is actually faster... #include int main(int argc, char * argv[]) { return (printf("hello World!\n")); }
Replying to my own post...
Also I got a 14% speedup using -O3 instead of -02 which he used in the tests. The Java compiler is optimizing automatically so the C++ test should also be optimized as much as possible. So 15% from changing the code and almost 15% from optimizing.
I saw this test a few days ago and wanted to check it out. The first thing I realize is that the source code is somewhat different even if Java has almost the same syntax as C++.
I understand that System.out.println(); is not in C++ but why have
instead ofI made the C++ code look like Java and got a 15% save. Problably even more if I had increased the number you call the program with. I looked at some of the other program and they have different code in them as well. So this test is bullshit it only shows that you can make slow programs in any language.