Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How would you fix Java?

by IlyaM (Parson)
on Apr 21, 2003 at 07:25 UTC ( #251953=note: print w/ replies, xml ) Need Help??


in reply to How would you fix Java?

It takes too many lines just to write a simple program

I don't really view this as a negative point. All code, up to and maybe even including one-liners, should be stored in a reusable, maintainable form. Also consider what percentage of your code is written in such a short form. Is adding a few extra straightforward lines of code really a huge inconvenience?

The thing is that in Perl it can be both less lines for same thing and it can still be a maintainable code. I recall I read a study that in average number of bugs in programs is proportional to a number of lines and the coefficient doesn't depend too much on language. So less lines means easier to maintain.

Please add your comments as to what you think about Java could be improved.

  1. Obviously a library of reusable compontents like CPAN (this is one of reasons why in Perl you can write less code).
  2. Ability to mix easily procedural, OO and functional styles of programming (though I doubt it will ever happen).
  3. Make it more dynamic language (think runtime generation of code, symbol tables manipulations, very flexiable OO without artficial restrictions like single inheritance, remove static typing - again I doubt it will ever happen as it will be completly different language :).

--
Ilya Martynov, ilya@iponweb.net
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org


Comment on Re: How would you fix Java?
Re: Re: How would you fix Java?
by Anonymous Monk on Apr 21, 2003 at 07:39 UTC

    Excellent comments, thank you for your reply :)

    A couple questions:

    Ability to mix easily procedural, OO and functional styles of programming

    How important is this to you and are you looking for something like Python's approach to this? Do you think it offers that much more usability than just throwing everything in a class?

    Obviously a library of reusable compontents like CPAN

    Is it just the more specialized modules you find lacking from Java (the Finance::Quote type modules), or is it problems with included libraries (including lack of api choices)?

      Ability to mix easily procedural, OO and functional styles of programming.

      How important is this to you and are you looking for something like Python's approach to this? Do you think it offers that much more usability than just throwing everything in a class?

      Frankly I'm Python ignorant (I have only walked through Python tutorial once and it was very long time ago so I forgot everything anyway :( ). Can you tell how it compares with Perl in this aspect?

      Obviously a library of reusable compontents like CPAN.

      Is it just the more specialized modules you find lacking from Java (the Finance::Quote type modules), or is it problems with included libraries (including lack of api choices)?

      I like that fact that there is central repository of reusable tested Perl components which are easy to install. In other languages you are either stuck with core libraries or you have to hunt for other libraries over all Internet. This discourages code reuse (how many times have you heard "I don't want to use this library but rather reinvent it myself so my users are not forced to deal with many external dependanices"). One negative side is that I think in other language communities programmers contribute less in reusable libraries. Another is that you see a lot of code going in core (think PHP, think Java) making it bloated.

      --
      Ilya Martynov, ilya@iponweb.net
      CTO IPonWEB (UK) Ltd
      Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
      Personal website - http://martynov.org

        Frankly I'm Python ignorant

        I'm fairly Perl-OO ignorant, (that's why I used Python as an example ;-) but I'm pretty sure they perform identically in respect to your comment. What I meant by the Python approach was that, in addition to the OO module approach, you can also just have a file with a bunch of subroutines and import them directly from that.

        I strongly agree with your last paragraph as well, especially about causing unnecessary bloat in the core.

        I'm not sure what you mean by talking about stuff going into the core with Java as "bloat," unless you're referring to raw download size of the JRE. It's by no means the same situation as with PHP, because Java has packages, while PHP does not. It can be quite maddening for quite a long time to figure out how one accesses one's preferred database in PHP, for example, since mysql_* and pg_* are both in the core (well, if you compile them in, they are).

        You can write a reasonably functional (if verbose) program in Java without using anything outside of the java.lang package (although, heh, you can't process a file ...); OTOH, if you need to process XML and you have JDK 1.4 or later, or you want to serialize some expensive-to-construct objects in Java, you can do it without having to download anything new. Yes, the base API documentation is huge, but you can do a heck of a lot with it. It's kinda like shipping a lot of CPAN in the distribution.

        It's by no means an official central Java repository of modules, and it's also by no means as comprehensive as CPAN, but the Apache Jakarta project has been developing reusable components, some of which are quite nice. I still prefer CPAN, but my point is that the Java picture is not as bleak as it is sometimes made out to be. Of course, for most textual processing, I still prefer to use Perl, but my view of Java is not as jaundiced as it used to be.

        If not P, what? Q maybe?
        "Sidney Morgenbesser"

      I think the point about CPAN is that there is no single place where you can load up on Java packages. I'm sure with enough time on Google, you could probably find Java equivilents to many popular CPAN modules. In some cases, CPAN modules were even directly inspired by Java packages (Log::Log4perl, for instance). But it's spread all over the Internet instead of one easy-to-search place. And there is no Java equivilent for saying "perl -MCPAN -e 'install Foo::Bar'".

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      Note: All code is untested, unless otherwise stated

Re: Re: How would you fix Java?
by Anonymous Monk on Apr 21, 2003 at 07:42 UTC

    I forgot one question, how do you feel about optional static typing? Thanks.

      Both thumps up. It is very perlish to support many styles of programming :) I just don't like when I'm forced to program in one specific style. BTW I think we've been promised to have optional static typing in Perl 6.

      --
      Ilya Martynov, ilya@iponweb.net
      CTO IPonWEB (UK) Ltd
      Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
      Personal website - http://martynov.org

        Better yet.

        In your typical statically typed language, what's typed is the name of the variable. If you are given an anonymous bit of data you have no indication as to what it is. In Perl, OTOH, you can find out whether it is a scalar, array, hash, anonymous code, or one of the more arcane types by looking at the data itself, without knowing about its name.

        Static typing in Perl is therefor likely to work much better than in your average conventional language.

        Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://251953]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2014-07-29 14:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (218 votes), past polls