in reply to Perl "with" Java

Dear Monks,

Excuse me for questioning some of your wisdom.

Perl, for me, has the benefit of short development time, a great support community and a vast library of public code. Which makes it superb for getting things done.

Java has all that too--except for the short development time.

well, as opposed to Python / Ruby etc... which seem to also be very popular, but in my mind stand a bit in the middle ground and are neither as good at the swiss-army-chainsaw stuff as Perl

On what basis do you make that claim? Personal experience? Studies comparing the two languages? Popularity?

I think the best advise is Don't try to write Perl code in Java

I think that is one of those statements that might sound insightful to some people, but in fact it's really hollow to the core. First of all, java doesn't let you write perl. Second, a programmer is the sum of their experience. They write code how they write it--within the confines of a given syntax and the libraries that are available. Third, if you learned the Decorator pattern in perl, it is still good programming practice to use the Decorator pattern in Java. As you learn a language, you naturally start assimilating the idioms employed by that language's community, so you don't have to try to do anything--except write lots of practice programs and ask questions on forums like these.

Nay, I think the best advice is to write Java programs anyway you can. You'll get the hang of it, and I think your perl experience will help you immensely. Every language you learn will help you become a better programer. And every language you learn, will make learning the next language easier.

I just have to warn you, though: Java's I/0 system is a complete nightmare, and in the past it was the biggest barrier to entry. Doing anything more than printing some output to the screen was nearly impossible for a beginner to figure out. In recent times, they've added some classes to make I/O easier for beginners, which makes learning java much easier than it used to be. Oh, and compiling and executing programs isn't easy either--unless you use an IDE that does all that for you. There are probably two people in the world that can compile their programs using the command line, and I've never seen any evidence that they post on the internet.

Replies are listed 'Best First'.
Re^2: Perl "with" Java
by Your Mother (Archbishop) on Nov 23, 2009 at 18:22 UTC
    Nay, I think the best advice is to write Java programs anyway you can. You'll get the hang of it, and I think your perl experience will help you immensely. Every language you learn will help you become a better programer.

    This is much like saying learning French will make you a better writer in German. It's only true if you are a decent writer already. It gives you more vocabulary and tools and the opportunity to think a bit more but sheer practice and experience don't necessarily make you better at anything. The opposite can be true. It can dig you deeper into bad habits and make you highly resistant--consciously or unconsciously--to knowledge outside the scope of those habits. Someone who writes terrible Java is likely, I'd say guaranteed, to write terrible Perl.

Re^2: Perl "with" Java
by gwadej (Chaplain) on Nov 23, 2009 at 19:33 UTC
    I think the best advise is Don't try to write Perl code in Java

    I think that is one of those statements that might sound insightful to some people, but in fact it's really hollow to the core.

    I really have to disagree with this statement, for two reasons.

    First, it is quite possible to try to write code using inappropriate idioms from another language. Over the years I have maintained Fortran code written in C, Java written in Perl, C written in Perl, and even Fortran written in Forth. A particularly stubborn programmer can often force idioms from another language into a different language. It is usually especially painful for any poor soul who must maintain this code.

    The second issue is the frustration caused by trying to write Perl in Java. Learning a new language by trying to translate the syntax explicitly will often result in much frustration. So the advice to not write Perl in Java could be considered as a reminder that you should keep the target language's idioms and syntax in mind rather than trying to use Perl's idioms.

    G. Wade
Re^2: Perl "with" Java
by BioLion (Curate) on Nov 23, 2009 at 16:50 UTC

    well, as opposed to Python / Ruby etc... which seem to also be very popular, but in my mind stand a bit in the middle ground and are neither as good at the swiss-army-chainsaw stuff as Perl

    On what basis do you make that claim? Personal experience? Studies comparing the two languages? Popularity?

    Bit of each, although Benchmarks game doesn't really back up what I am saying - so i guess it is mainly personal experience. The main point everyone seems to be making is that learning more languages, gaining experience and forming your own opinions and finding what works for you is the key lesson. This is the opinion i have formed (so far), that's all.

    Just a something something...
      I don't see what the execution speed measured on the benchmark website has to do with whether Python and Ruby occupy the middle ground. Except that that cleary shows that neither Python, Ruby or Perl are fast enough to be a substitute for C++ (or Java) in time critical code.

      My (nearly uninformed) guess is that Python and Ruby can't compete with Perl on the low level aka sysadmin stuff but have the same limitations as Perl in really big projects