Welcome To

Guess The LoC!

Or: How Much Code Do You Really Need?


Stefan Reich
JavaX Technologies
BotCompany.de


15. 11. 2016, presented @ HH.JS @ SinnerSchrader

Let's start with something
simple - a GUI.

How Many Lines

...to make a Swing form?

 

In JavaX: 8 lines, counting very generously

 


 final new JTextField tf1;
 final new JTextField tf2;
 showForm(
   "First Name", tf1,
   "Last Name", tf2,
   r {
     messageBox("Hello " + tf1.getText() + " " + tf2.getText() + "!");
   });

Now for the first shocker!

How Many Lines

...for dynamically loading modules from the repository into your program?

 

 Class c = run("#765");

One line in JavaX!

Afterwards, access class members by reflection.

Loaded code sits on server

e.g. at tinybrain.de/765

 set(c, "debug", true);
 call(c, "doStuff");

Now for the
Super-Shocker!


Stuff you just didn't think could be real.

How Many Lines

...to keep all your Java objects between program runs?

 
 concepts.
 
 concept Language { String name; }
 concept Word { String word; }

 concept ProbablyInLanguage {
   new Ref<Word> word;
   new Ref<Language> language;
 }

2 super-simple lines of JavaX - plus minor class modifications.

 

 concepts.
 
 concept Language { String name; }
 concept Word { String word; }

 concept ProbablyInLanguage {
   new Ref<Word> word;
   new Ref<Language> language;
 }

 p {
   conceptPersistence();

   uniq(ProbablyInLanguage,
     word := uniq(Word, "clown"),
     language := uniq(Language, "english"));
 }

Let's shock some more -this time involving
two devices.

How Many Lines

...to, within any PC program, delegate some computation to an Android phone?

 

 

[Start the "Awareness" app on the phone first and connect PC & phone through tethering.]

 print(onPhone("sqrt(2)"));

One line in JavaX!

 

JavaX REPL on PC:

Code runs in full Java speed!

99+% is compilation
(= can be eliminated)

...and the final revelation.

Does it work

...the other way around too? (The phone calling the PC)

 

 

[Start the "Awareness" program on the PC and connect PC & phone through tethering.]
 

JavaX programs generally run unmodified on Android & PC.

 print(onPC("sqrt(2)"));

Sure!

 

And we got so
much more...

javax.tinybrain.de


Sponsorship Status:

  • rejected by 5+ startup accelerators already
  • getting a room to work this week

How Much Code Do You Really Need?

By Stefan Reich

How Much Code Do You Really Need?

4 JavaX Magic Feats

  • 2,177