5 ms·
Write once, read never.
by lovelyday 12y ago
Write once, read never.
- Roboprog 12y agoSpeak for yourself! (or maybe, for annoying coworkers???) It's certainly possible to write functions (subs) with comments about what they do, and use meaningful variable names. The built-in syntax/operators do require some study, though. For the "Enterprise!" developer pool, there's Java. The 500 line methods are still hard to slog through, though. Too many never got the note about a "business logic layer" and abstraction, and just shove all the details in-line. In which case, the language of mandate doesn't matter much.
- EdwardDiego 12y ago> For the "Enterprise!" developer pool, there's Java. The 500 line methods are still hard to slog through, though. Great straw-man there. I didn't realise that javac required 500 line methods before compilation. > In which case, the language of mandate doesn't matter much. It's a lot easier to pass two collections to a method in Java than to a sub in Perl.
- deleted 12y ago[deleted]
- EdwardDiego 12y agoYour reply makes no sense to me I'm afraid. > And I didn't realize the well written Perl code compiles equally better. Equally better? > And its certainly a lot easier to open files and do things in Perl than writing several hundreds of lines just to set and get variables for one single class. Come on, seriously. Here's how I open files in Java: import com.google.common.io.Files; List<String> lines = Files.readLines(new File("/foo"), Charset.UTF8); Why do you insist on straw-men to back up your arguments?
- deleted 12y ago[deleted]
- EdwardDiego 12y ago1) It's a library, there's no need for One True Library. Especially not in a Perl thread (CPAN is awesome). You use whatever works best for you. 2) Caught and re-thrown as a RuntimeException by the library. 3) No idea, but if I need that low level of control, I wouldn't be using a readLines convenience method. 4) Like you can pass files as a parameter, and create lists of them to iterate over. 5 - 8 are a different problem domain. But I was merely answering your hundreds of lines to read a file straw-man. I never suggested Java be used as a scripting language, if you really want to script on the JVM, use Scala, Groovy, Clojure or Kotlin. But personally, I script in Python. Let's resurrect that old pissing match with Perl. ;)
- Poiesis 12y agoSo, I actually have no love for Java, and am greatly enjoying the higher proportion of scripting irb been up to lately. But I had to comment on a couple things: > Why only that library...? I've seen it all when a Perl developer is calling out a Java developer regarding TMTOWTDI. Nice library though. >I would like to execute some shell commands Not sure comparing to a language with an explicit complicit compilation step is fair.
- Roboprog 12y agoFWIW, I do more Java than Perl at work, though a fair amount of both. I guess I have written both "in anger", depending on the situation. I guess the thing that gets under my skin about Java is that it is the mandatory one true language at so many workplaces.
- Roboprog 12y agoOn the one hand, that's a pretty cool library. (with a function to emulate back-tick into an array) On the other hand, now I have to go to the Enterprise Committee with a Permission To Install Library Form to get it, since it's not part of the base language. It might well be worth it to use Google's jar, but it's a delaying nuisance.
- Roboprog 12y ago--- Java --- List <Integer> aList = Arrays.asList( new int [] { 1, 3, 5 }); // probably missing some more type stuff in <> Map <String, String> aMap = new HashMap <String, String> (); aMap.put( "name", "Joe"); aMap.put( "ID", "42"); // I need to check if Java 8 has map literals a la Groovy... doSomething( aList, aMap); ... void doSomething( List <Integer> aList, Map <String, String> aMap) { System.out.println( "First: " + aList.get( 0) + ", Name: " + aMap.get( "name") ); } --- Perl --- &do_something( [ 1, 3, 5 ], { 'name' => 'Joe', 'ID' => '42 }); ... sub do_something { my( $list_ref, $hash_ref) = @_; printf "First: %d, Name: %s\n", ${ $list_ref }[ 0 ], ${ $hash_ref }{ 'name' }; } ------ I'm not seeing that much of a difference in parameter passing, other than the explicit reference/dereference syntax. Of course Java doesn't require 500 line methods. But the bondage and discipline imposed is independent of whether or not readable code will be produced. I actually like strongly typed languages for larger programs, but prefer something more fast and loose for smaller ones. TMTOWTDI!
- Roboprog 12y agoI guess that bottom line of what I am trying to say is that not all perl code is unreadable crap. That has more to do with the writer than the language. And, different languages make different things easier. No final "right" or "wrong" choice for all use cases.
- EdwardDiego 12y ago> I guess that bottom line of what I am trying to say is that not all perl code is unreadable crap. That has more to do with the writer than the language. And, different languages make different things easier. I would agree. It's the same issue Scala faces IMO - it doesn't have to be a complex maze of types and implicit conversions and implicit values, you can, if disciplined, write very understandable and clear Scala. Sadly though, it seems a lot of developers aren't disciplined.
- mst 12y agoWith great power comes great capacity to write overly clever unmaintainable crap.
- iopq 12y agoIt's certainly possible to write functions (subs) with comments about what they do, and use meaningful variable names in Assembly too.
- CatMtKing 12y agoI can read Perl, but the only way you'll get me to read it is to write a script with bugs in it and force me to debug it. It's fun in a masochistic sort of way. Anyway, Python and Haskell are my languages of choice now.
- BugBrother 12y agoAccount literally created a few minutes before posting. YALT -- yet another languagewar troll.
- seanmcdirmid 12y agoIt's not the first time someone has called Perl a write-only language, I heard that joke first in 1996.
- BugBrother 12y agoOld trolling is respected? Something like religion then, were people hearing voices long ago got followers -- but today generally are locked up? :-)
- seanmcdirmid 12y agoPerl has always been the butt of write-only jokes within the PL community; just imagine Perl as Rodney Dangerfield complaining that it "gets no respect." APL is of course, the canonical write-only language, but it is completely honest and accepting about it. I programmed in Perl for CGI in the mid 90s and didn't see anything wrong with it. It was weird, but I had programmed with much worse before then (Lotus Notes Script...whew), so I wasn't really bothered by it. That being said, I see no reason ever to write another line of Perl again.
- BugBrother 12y agoWell, not really relevant for either Modern Perl or my point. (Or that it gets a bit old after a few hundred times on HN, now with newly created accounts. No one want anyone to do the same for other subjects.) Mid 90s? 20 years ago, just after the release of Perl 5 and before everything else? I understand your opinion... :-)