Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I love Perl OO because it is bare-bones and does not push you to do things. I think the other end of the spectrum is Java which probably should have been invented in 1933. (In fact this Jawa_Moto was invented in 1929.)

Exceptions in Java and Perl are similar semantically. But exception objects are thrown in Java. For which the Perl equivalent is explained here : https://www.perl.com/pub/2002/11/14/exception.html . And that's a good idea. Of course Java's beauraucracy has an Exception class for each and every conceivable failure in machine activity both on Planet earth and extra-terrestial territories (I am sure somewhere the idea is or has been hatched: HALCantDoThatException). But don't let that scare you because you can do away with using the parent Exception class for everything (though it could be frowned upon).

The other thing is Java Generics (sort of equivalent idea is C++ templates). I mention this because Java is strictly typed and that can hit a Perl programmer. Each variable must have a type. And each method accepts and returns strictly typed objects/scalars. Where this paradigm fails is when trying to implement general methods for, for example, sorting. And that's where the Generics come in. And that's where the "pollution" of Java with new semantics starts and never ends... latest addition the lambda expressions which lead to code like this: IntStream.iterate(1, i -> i < 100, i -> i + 1).forEach(System.out::println); which is the Marquee's De Sade way of printing in a loop. Personally, it reminds me of assembly.

Java has excellent, IMO, documentation framework, javadoc. Similar to pod. And it's worth getting to know that before anything else.

One other good thing in Java is the Interface notion. Which allows completely unrelated classes to be treated as similar wrt just one aspect of their operation. For example you can have a "stringable" interface to make sure that all classes which implement it have a stringify() method. And so you can say class1 A; class2 B; print(A); print(B) without using Generics, because both class1 and class2 implement the interface and print() is assured that it will find a stringify() method to call in both A and B. This is a great feature which avoids the mess of multiple inheritance (not supported in Java) with all the benefits, including avoiding situations like A.stringify(); ... no such method exists . There is also the Comparable interface (requiring the existence of method compare(A,B)) which allows to compare unrelated objects.

Java recognised the importance of regular expressions (just like Perl) and supports them well. However, unlike Perl, there is boilerplate. So, this is another field I would investigate to be comfortable and make the most use of, just like in Perl. Also, Java recognised early the importance of some basic "geeky" data structures like Hashtable, (Tree), etc. (which Perl also did and it was one of its great contributions to the world and a revolution really whereas C++ didn't dare to do that when it did matter.) and are supported really really well.

Finally, Java comes with its own Graphical toolkit. Which allows you to write multiplatform GUIs. Java will also open a door into the Android apps world.

bw, bliako


In reply to Re: Java Recommendations for a Perl developer by bliako
in thread Java Recommendations for a Perl developer by talexb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found