Java and Perl

a walk on the beach

about me

public class AboutMe {
    public static void main(String[] args) {
        System.out.println("Java Developer and Trainer");
    }
}
#!/usr/bin/env perl

print 'I used to be a Perl Dev.', "\n";

Hello World Should Be One Line?

  • classes, privacy, types, methods
  • arrays, chained method calls
  • what the file is named is important!

what people say ... 

development slow

over-engineered code

forced OOP

scales

what people say ...

doesn't scale

line noise

cleverness, correctness

small code size

not this talk!

scalability

garbage collection

typing

exception handling

garbage collection

perl5 ref count, undef ...

java automagic - YMMV!

perl6 moarvm 2-stage

typing

  • static
    • safety
    • runtime speed
    • morer righter
  • dynamic
    • more expressive

typing

  • java static but i can cast
  • perl5 dynamic but Moose, introspection
  • perl6 ...

exception handling

  • perl5 eval, Try::Tiny
  • java try{..} catch(){..} finally
  • perl6 try{ CATCH { when{..}} die}

practical

  • jobs? J=2, P=14
  • will your skills xfer?
  • what do you need?
    • stability?
    • flexibility?
    • speed?
  • does your language/tools help/hurt?

conclusion

  • the language doesn't matter: the algorithm does.
    • ​i don't mean only math

use the right tool for the job

use both!

links

  • http://bit.ly/2cneUPE

  • http://bit.ly/2bXk6G0
  • http://bit.ly/2bKHjQI

+[----->+++<]>+++.+++++++++++.--.+.[---->+<]>+++.[->+++<]>+.+++++++++++++.+.+++++.------------.---.+++++++++++++.[-->+++++<]>+++.[-->+++++++<]>.-----------.+++++++++++++.------.[++>---<]>--.-[--->++<]>--.-------.++.++++++++.------.+++++++++++++.

The inner class Blah.CommandActionTriggerListener is not declared static and hence each instance is bound to the parent action object. This action object has references to UI related objects. This way the asynchronous tasks in the scheduler use much more heap than needed which makes the GCs job unnecessary hard.

We have seen a system where this added up to 1Gigabite of heap.

If I am right then adding the static modifier to the inner class would be enough.

deck

By elohmrow

deck

  • 2,002