--JaroslavTulach 09:52, 22 January 2015 (UTC)
Bck2Brwsr @ 0.13 Released - 2015-01-12 09:27:00
Impossible. Part II. - 2015-01-03 19:23:00
Everybody understands threading is complex. Yet almost everyone believes that with good methodology it is possible to do threading right. Well, it is not. There is no theory to eliminate deadlocks. Achieving proper threading is impossible. Still people keep asking for it. When you tell them it is impossible, you may get fired. Just like me few years ago! Here is my story.
--JaroslavTulach 19:23, 3 January 2015 (UTC)
Bck2Brwsr @ 0.12 Released - 2015-01-01 21:53:00
Bck2Brwsr 0.12 has been released. What is new?
Libraries can be pre-compiled and published as Maven artefacts (see Bck2BrwsrLibraries how to). The Knockout4Java Maven archetype has been modified to use the precompiled version of Bck2Brwsr rt. jar emulation library and HTML/Java APIs:
$ mvn archetype:generate \ -DarchetypeGroupId=org.apidesign.html \ -DarchetypeArtifactId=knockout4j-archetype \ -DarchetypeVersion=1.1.2 \ -Dbck2brwsr=true # answer few questions... $ cd nameofyourproject # run on desktop $ mvn process-classes exec:java # run in a browser $ mvn -Pbck2brwsr clean package bck2brwsr:show
--JaroslavTulach 21:53, 1 January 2015 (UTC)
BinarySelection - #1 Rule of HR - 2014-12-23 06:20:00
BinarySelection plays (except having its classical search meaning) an important role in theory of HR management. It defines what happens when employees are leaving the employer (either voluntarily or after being fired):
BinarySelection means, that "ones" leave and "zeros" stay.
I mention this definition whenever we chat about life of software developers and it always generates grin smile. Of course, because it is so true! I can confess that as for last seventeen years I have been sticking with my job surviving any layoffs and acquisitions: I've seen so many "ones" leaving, but the rest of us is still marching on!
--JaroslavTulach 06:20, 23 December 2014 (UTC)
Publish Bck2Brwsr Libraries as Maven Artifacts - 2014-12-07 05:21:00
Wrap Your JAR as OSGi Bundle via Maven Easily! - 2014-11-29 13:07:00
Not all artifacts in a Maven repository are packaged as OSGi bundles. Yet, some systems (like for example the Bck2Brwsr ahead-of-time compiler) require JAR to contain OSGi meta-data. Luckily there is a simple way to turn any JAR into OSGi bundle by creating a simple Maven project. Here is the sample pom.xml:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion>4.0.0</modelVersion> <groupId>your.group.id</groupId> <artifactId>jar-id</artifactId> <version>1.0-SNAPSHOT</version> <packaging>bundle</packaging> <!-- we want to produce an OSGi bundle --> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <repositories> <!-- we are wrapping a JAR from NetBeans Maven repository --> <repository> <id>netbeans</id> <name>NetBeans</name> <url>http://bits.netbeans.org/maven2/</url> </repository> </repositories> <dependencies> <!-- specify the dependency you want to wrap as OSGi bundle --> <dependency> <groupId>org.netbeans.external</groupId> <artifactId>nb-javac-api</artifactId> <version>RELEASE80</version> <!-- we need the dependency only during compilation --> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.3.7</version> <extensions>true</extensions> <configuration> <instructions> <!-- export the packages that should be externally accessible --> <Export-Package>javax.*</Export-Package> <!-- list other packages that should be included in your bundle --> <Private-Package>com.sun.*</Private-Package> </instructions> </configuration> </plugin> </plugins> </build> </project>
And that is all! After building the project, you'll get an OSGi bundle that contains all the classes from the specified dependency found in exported and private packages. Just copy the above text into pom.xml file and in its directory execute yourself:
$ mvn package $ unzip -l target/jar-id-1.0-SNAPSHOT.jar # shortened ... 4539 2014-02-14 11:52 com/sun/source/util/Trees.class 125 2014-02-14 11:52 com/sun/source/util/package-info.class 5109 2014-02-14 11:53 javax/annotation/processing/AbstractProcessor.class # ...shortened $ unzip -p target/jar-id-1.0-SNAPSHOT.jar META*MAN* Manifest-Version: 1.0 Bnd-LastModified: 1417267436493 Build-Jdk: 1.8.0_25 Bundle-ManifestVersion: 2 Bundle-Name: jar-id Bundle-SymbolicName: your.group.id.jar-id Bundle-Version: 1.0.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: javax.annotation.processing;uses:="javax.lang.model,java x.tools,javax.lang.model.element,javax.lang.model.util";version="1.0.0. SNAPSHOT",javax.lang.model.util;uses:="javax.annotation.processing,java x.lang.model,javax.lang.model.element,javax.lang.model.type";version="1 .0.0.SNAPSHOT",javax.lang.model;uses:="javax.lang.model.element";versio n="1.0.0.SNAPSHOT",javax.tools;uses:="javax.lang.model.element,javax.an notation.processing,javax.lang.model";version="1.0.0.SNAPSHOT",javax.la ng.model.type;uses:="javax.lang.model.element,javax.lang.model";version ="1.0.0.SNAPSHOT",javax.lang.model.element;uses:="javax.lang.model.type ,javax.lang.model";version="1.0.0.SNAPSHOT" Import-Package: javax.annotation.processing,javax.lang.model.element,jav ax.lang.model.type,javax.lang.model.util,javax.tools Tool: Bnd-1.50.0
--JaroslavTulach 13:07, 29 November 2014 (UTC)
Bck2Brwsr and Images as Resources - 2014-10-30 01:19:00
Impossible. Part I. - 2014-10-20 14:25:00
Explaining that something is impossible is, well impossible! Here is a link to one viral video and one story from my computer science student years, which is so true, I would almost cry. In case you find my impossible story interesting, let me know. I have at least two more on the same impossible topic!
--JaroslavTulach 14:25, 20 October 2014 (UTC)
Duke Choice Award - 2014-09-29 17:37:00
invokeDynamic is wrong idea. Especially for implementation of lambdas! - 2014-09-25 12:50:00
When I was younger I used to believe that having invokeDynamic instruction in JVM can be beneficial. Now, few years later and after spending time to implement lambdas in my Bck2Brwsr VM and seeing things from the other side I have to admit I was wrong. invokeDynamic is wrong idea (especially for implementation of lambdas).
It is JavaOne time, I have a talk about my Bck2Brwsr together with Niclas from RoboVM, so let's show I understand what is wrong with JVM and start a little rant! I need something from the JDK guys, so let's give them a reason to welcome me with open arms when we see each other in San Francisco:
--JaroslavTulach 12:50, 25 September 2014 (UTC)
Lambdas Go Bck2Brwsr! - 2014-09-15 17:48:00
--JaroslavTulach 17:48, 15 September 2014 (UTC)
Play MineSweeper to Become iOS, Android, JavaFX & co. Developer - 2014-09-15 10:57:00
JavaOne2014: Need Speakers for My Session! - 2014-09-10 18:56:00
JavaOne2014 is around the corner and my sessions have been scheduled. I start with a BOF on Monday evening called Virtually Inside-Out! - it is going to be discussion between authors of alternative JVMs. So far we are two: I have mine Bck2Brwsr and Niklas has RoboVM.
Don't you know a developer working on own JVM who will be at JavaOne2014? If so, please tell him to contact me and stop by! I plan to make the BOF a lively chat (how did you implemented lambdas?, how did you implemented defender methods?), but in case we don't have a topic to talk about, I am ready to explain why value classes should not be in JVM and why InvokeDynamic is a completely stupid idea. Anyone from JDK team to defend these proposals?
On Tuesday morning Toni and me will continue with DukeScript tutorial. In case you use Java and want to learn how to code for iOS, Android, JavaFX and browsers, stop by. We will help you create your first application that is written once and displayed anywhere!
I'll finish on Tuesday noon talking about API Design checklist. I'd like to name at least ten things one should check for, but so far I have about two. Don't you have any idea what could be in such checklist? If so, please talkback!
--JaroslavTulach 18:56, 10 September 2014 (UTC)
Develop in NetBeans and Deploy to AppStore - 2014-08-21 15:29:00
Minesweeper for iOS has been published. First iBrwsr powered DukeScript application has been deployed to AppStore. If you own an iPad or iPhone, give it a try: https://itunes.apple.com/us/app/fair-minesweeper/id903688146
--JaroslavTulach 15:29, 21 August 2014 (UTC)
Sources for the Practical API Design book - 2014-08-08 11:16:00
Hear the news: Sources in ZIP format are back!
My Hudson server crashed in early months of 2014. I had to configure it from scratch. While doing so, I forgot to configure the job to produce apidesign.zip file with sources. Has anyone noticed? Nobody sent me an email! Just yesterday Jáchym, my co-worker, who I torture by forcing him to read TheAPIBook and become good API designer, stopped in my office and timidly asked: Where can I get the sources? There is no ZIP file!
For a while I tried to blame him for not using Mercurial, but after a while I realized the problem is on my side. As a result, the zip file with sources is back as of Aug 8, 2014. Will anyone use them? It would be nice as reading Practical API Design book without having whole sources at your hand is like trying to understand Swing just by reading its Javadoc.
--JaroslavTulach 11:16, 8 August 2014 (UTC)
Develop in NetBeans and Deploy to GooglePlay - 2014-07-31 05:17:00
Minesweeper for Android has been published. First DlvkBrwsr powered DukeScript application has been deployed to GooglePlay. Give it a try: https://play.google.com/store/apps/details?id=org.apidesign.demo.minesweeper
--JaroslavTulach 05:17, 31 July 2014 (UTC)
Japanese Translation is Real - 2014-07-17 06:51:00
Use NetBeans to Deploy Everywhere! - 2014-06-18 11:09:00
Client Java everywhere is now possible thanks to essential part of DukeScript - its capability to deploy to almost any device on the planet (that can render HTML). One can configure everything in an IDE independent way, but the best way to start is to get your instance of NetBeans 8.0 and follow few easy steps:
Install the Plugin
Go to Tools/Plugins, refresh the catalog, select available plugins tab and install HTML/Java Project Support.
Create New Project
Now create new project. There are multiple prepared versions of the project in the NetBeans project templates tree, but the most generic one is HTML5 with Java Application Logic.
After seeking a wizard step with project description and easy access to essential documentation you need to specify the location where to create your project, the starting template to use and then you need to decide few important questions.
Deploy to Android?
Deploy to iOS?
To deploy to iPhone or iPad you need to be running on Mac.
Deploy to Any Browser?
Create a NetBeans Extension?
Why not package your application for NetBeans users when you don't have to change a single line of code?
After this step just press Finish and wait for Maven to download necessary libraries.
Once the project is generated you can debug it. Then debugging of your Java code is enabled and you can hit breakpoints, evaluate watches, do step into or over, inspect the stack (right bottom side of the picture).
Together with with that an HTML DOM browser (left bottom corner) is enabled that allows you to inspect your HTML page as you are probably used to from Firefox and Chrome (including selection mode). From here you can easily navigate to CSS styles inspector and also into the source code.
When you are happy with your application you can package it to one of the target platforms by using Custom submenu:
Enjoy writing once and displaying everywhere with Java!
--JaroslavTulach 11:09, 18 June 2014 (UTC)
Bck2Brwsr Revision 0.9 is Released! - 2014-06-10 06:34:00
Version 0.9 eliminates useless stack assignments. Instead of doing
var stI0 = lcI0; var stI1 = lcI1; var stI0 = stI0 + stI1; return stI0;
the now generated code is
return lcI0 + lcI1;
Optimized the ahead-of-time compilation, so now the http://xelfi.cz/minesweeper/bck2brwsr/ demo starts up instantly. I had to do it, because it was so embarrassing to see TeaVM to boot the same application so quickly: The initial delay is gone, and moreover it downloads necessary libraries in parallel and on background. Now we are ready for next step: share the libraries between different applications.
--JaroslavTulach 06:34, 10 June 2014 (UTC)
Podcast related to Japanese Translation - 2014-06-02 18:45:00
MineSweeper on iOS - 2014-05-21 14:13:00
Epistemology of Software Design - 2014-05-15 20:01:00
Epistemology of software design by Nathan is online! I greatly recommend it to everyone who wants to produce software that lasts! After all those years with NetBeans I can only confirm everything Nathans describes!
If you want to stop being a software engineer and become software architect, epistemology of software design is one of the things you have to memorize!
--JaroslavTulach 20:01, 15 May 2014 (UTC)
Lower Your Profile! Adopt JDK8! - 2014-03-23 11:40:00
TeaVM Can Execute DukeScript Applications! - 2014-03-20 14:27:00
Alexey just released his first version of TeaVM. Congratulation!
Well, everyone now writes virtual machines that run in a browser, but TeaVM is special - rather than separating and playing on its own sand field - Alexey decided to speak DukeScript. As a result, the same application can now be deployed to Bck2Brwsr and TeaVM and we can compare which virtual machine is better - or at least play minesweeper 1 and minesweeper 2.
--JaroslavTulach 14:27, 20 March 2014 (UTC)
--JaroslavTulach 15:53, 20 February 2014 (UTC)
Avoid Synchronization Problems - 2014-02-14 16:24:00
It, this and that: Optimizing for Cost of Ownership - 2014-02-11 10:53:00
Good Advice - 2014-02-06 08:04:00
How do you recognize Good Advice? We already know what a good technology is, can we use the same concept to evaluate whether an advice is good or not? Let me answer that by a quote from TheAPIBook which Yoshiki asked about:
Part 1 presents all of API design as a scientific discipline with a strong rational background, not as the art that it sometimes pretends to be. It defines terminology and initial prerequisites that can objectively help us measure if an API design is good. These rules try to be language neutral and applicable to any programming language, not just Java. The theory is unlikely to be complete. Other principles of API design exist elsewhere or are still waiting to be discovered.
However, that should not scare us, as Chapter 1 gives us a tool to evaluate the quality of various principles to find out whether a certain piece of advice helps us design better shared libraries and their APIs or not. It gives us the grand meta-principle: selective cluelessness. This cluelessness is a tool that can measure whether various goals really help. That’s because if they allow people to know less while achieving more and building better software systems more easily, then this advice is good. There is a need for this advice, especially in the future, when software systems will outsize the intellectual capacity of any of their designers.
Yoshiki: What do you mean by this advice?
"this advice" is a reference to advice mentioned in "to find out whether a certain piece of advice helps us design better shared libraries". To rephrase: any advice that helps users increase cluelessness is good and it will be even more valuable in the future when we start to build even bigger systems.
--JaroslavTulach 08:04, 6 February 2014 (UTC)
Japanese Translation of Practical API Design - 2014-01-27 09:28:00
--JaroslavTulach 09:28, 27 January 2014 (UTC)
Changes: HTML for Java, videos and hosting - 2014-01-14 08:24:00
I'd like to announce few changes related to apidesign.org site.
First of all, the Knockout4Java is now a NetBeans subproject and yesterday I managed to release its first bits as a stable version 0.7 - follow three simple steps to see how powerful Java/HTML user interface can be.
The other change is that I am migrating the whole website to new hosting infrastructure. Sources are up, mediawiki as well. However I still need to recover mailing lists, etc. If you find something that is not working and should, please Talkback. Thanks in advance.
One thing you don't have to complain is lack of videos - this is what one gets when using a cloud service! My uploaded screencasts had been found inappropriate and were deleted - after four years of being OK! Should I upload the backup copies (that I can find) elsewhere or rather host it myself?
--JaroslavTulach 08:24, 14 January 2014 (UTC)
Unify Eclipse and NetBeans UI - 2013-12-21 18:01:00
--JaroslavTulach 18:01, 21 December 2013 (UTC)
JavaFX for iOS via NetBeans - 2013-12-10 12:42:00
With the help of Prague's JavaFX iOS team we now have a NetBeans plugin that helps anyone develop JavaFX based Java apps for iOS. Many thanks should also go to RoboVM guys for creating such easy to use Maven plugin.
--JaroslavTulach 12:42, 10 December 2013 (UTC)
API Design Guidelines - 2013-12-02 09:30:00
Cloud IDE for Kids - 2013-12-02 08:48:00
The Smallest Linux JDK - 2013-11-27 15:12:00
DEW - Java Meets Web with Your Help! - 2013-10-28 16:56:00
--JaroslavTulach 16:56, 28 October 2013 (UTC)
Pervert Your Language to Become a Better Programmer - 2013-10-16 13:02:00
Do You Know What a WeakReference Can Do to Your API? - 2013-10-11 08:50:00
Maven and Bck2Brwsr 0.8 - 2013-09-29 12:22:00
Can Deserialization Change Value of a Final Field? - 2013-09-23 16:58:00
The Art of Writing Equals in Object Oriented Languages - 2013-09-06 08:53:00
Use the Debugger, Stupid! - 2013-08-20 09:17:00
JDK8's Profiles in the Light of Harmony - 2013-08-12 14:54:00
A curious translator of my book asked me about project Harmony. That motivated me to sit down and write an incomplete and mostly wrong history of open source java implementations. While incomplete (for example it does not talk by whom Harmony was founded and why), it explains why JDK8 is/will be a huge step forward and what will be its most important feature. Btw. if you thought lamdas, you were wrong.
--JaroslavTulach 14:54, 12 August 2013 (UTC)
Bck2Brwsr Goes Server Side: Run the Same Code on Server and Client! - 2013-05-20 12:45:00
I'd like to introduce my small contribution to Jersey project. It provides (yet another, but this time very lightweight) converter from Java to JSON and back. Together with Bck2Brwsr or FXBrwsr you can now smoothly execute the same Java code on client as well as on your server.
--JaroslavTulach 12:45, 20 May 2013 (UTC)
Introducing Knockout4Java - 2013-05-16 21:32:00
Bck2Brwsr 0.7 Released! - 2013-05-09 07:50:00
- FXBrwsr with full debugging support and a demo
- Dual Twitter demo - single source code, dual deployment (watch the same demo)
- Lightweight, generic JSON <-> Java mapping: javadoc
- ProviderAPI and a TCK to bind to other technologies than Bck2Brwsr, Knockout.js and FXBrwsr: javadoc
- Follow naming convention -- now bck2brwsr-maven-plugin -- thanks to Miloš Kleint
--JaroslavTulach 07:50, 9 May 2013 (UTC)
Introducing FXBrwsr - 2013-04-30 09:25:00
Bck2Brwsr 0.6 is Released! - 2013-04-14 21:24:00
Now you can write your own real applications for browser in Java:
- Full featured demo Twttr demo
- Bck2Brwsr provides better binding of complex classes (defined by a special @Model) annotation
- The @Model classes can be obtained from a server via JSON and JSONP. Use @OnReceive annotation
- Browser testing harness has nicer output with UL and expandable LI
--JaroslavTulach 21:24, 14 April 2013 (UTC)
Older Blog Posts - 2013-04-14 21:00:00
Cimrman's Planning - 2013-03-19 15:10:00
Javadoc for Coding for Your Browser Published! - 2013-03-01 09:11:00
Platón's Theory of Ideas for Developers - 2013-01-21 08:45:00
Those of you who heard about Platon in school probably also hard about his allegory of a cave (at least I did when I was at high school). It is not often easy to imagine what Platon meant by the cave, shadows, etc. Luckily (at least for developers who know what geometry is), there is a better explanation which which explains Platon's theory of ideas via geometry.
This geometric way of explaining [[ideas was much easier for me to swallow. That is why I decided to share it here.
--JaroslavTulach 08:45, 21 January 2013 (UTC)
On the fact that the Atlantic Ocean has two sides - 2013-01-17 11:56:00
Here are selected notes from my favorite write up by Edsger W. Dijkstra (the guy that invented semaphore). Few decades has passed since the initial publication and the difference between U.S. and Europe may not be as sharp anymore. Still, a lot of Dijkstra's comments apply - especially when it comes to the clash between programmers educated in soft vs. real science schools!
Btw. should this kind of analysis be found interesting, I can share another one: Why our U.S. friends can't read maps and are not aware of that. Just let me know if I should publish it.
--JaroslavTulach 11:56, 17 January 2013 (UTC)
Having a Hammer All Problems Look Like a Nail - 2012-11-12 13:37:00
TransitivityOfIncompatibleChange - 2012-11-07 02:00:00
A nice clash between real world and academic attempts to describe it can be seen on the case of TransitivityOfIncompatibleChange. While such transitivity is an easy to grasp concept, it is too simplistic and often too hard to apply for the real world of software dependencies. It took me a while to understand its alternative, but now I think I see it.
Last week I had a presentation about the topic of NP-Complete problems in module dependencies at MatFyz and one of the questions was: Why am I not using TransitivityOfIncompatibleChange in case of repositories with RangeDependencies? Well, I don't as it does not have a clear meaning. But the question forced me to sit and write the answer down.
--JaroslavTulach 02:00, 7 November 2012 (UTC)
Is Java a Language or a Framework? - 2012-10-18 09:06:00
20 API Paradoxes Published! - 2012-10-11 18:11:00
Today I am ready to announce great news. My new book about 20 API Paradoxes is now publicly available. I'd like to thank everyone who helped me get it to e-readers all over the globe. Jeff corrected my English and made the structure of the book more consistent. Clay stopped me when I wanted to expand the scope and delay the publication. And, most importantly, Clay is responsible for this fantastic cover:
I hope you like the cover too. And not only that, I hope you'll like the content as well. Buy & enjoy!
--JaroslavTulach 18:11, 11 October 2012 (UTC)
C++ May Not Be As Bad As Thought! - 2012-09-27 07:40:00
Do you remember my recent post about object oriented encapsulation and performance? It was written in a response to an article that claimed C is much better than C++. There in given example nicely illustrates that by giving up on encapsulation one can implement more effective linked list. In my recent post I managed to prove that by using traits, one can easily get the same performance while keeping encapsulation in modern object oriented language. Only one question remained: Can one do the same with C++ templates?
I am glad to report we have an answer with a sample code. There is a way to write generic template (well two of them) and orchestrate them in a way that keeps encapsulation and maintains the C linked list performance. C++ is not as bad as I thought.
Last note related to this incident (influenced by book I am currently reading). There are tons of comments attached to the original article yet most of them are really shallow. Usually along the line of that is a non-sense!, use STL! or C rules, I knew it!. I guess this has something to do with Thinking, Fast and Slow: people were provoked to react instantly by seeing a topic they had already have an opinion about. Without really giving the issue a though, they replied using fast thinking.
It took me a weekend to come up with the trait solution and we needed about a week to polish the C++ sample code. Looks like a little bit of slowness can worth tons of fast made opinions. But that is for another story - first of all I need to finish reading Thinking, Fast and Slow book.
--JaroslavTulach 07:40, 27 September 2012 (UTC)
Older Blog Posts - 2012-09-27 07:00:00
100th Monkey Principle. Multicasting in a Nature? - 2012-08-08 19:29:00
James Borowski on 100th Monkey principle:
Found reading some stuff on your site really interesting. I have not finished reading yet, so, forgive me if you already know this, but I was reading the article DiamondsVsStars and wondered as I read your comments regarding the "something in the air" as people around the world all discover something at the same time, if you were aware of the 100th Monkey principle?
There are different versions of the tale, but essentially, there was an island with a load of monkeys that learnt a trait one at a time of how to knock nuts with a rock to get inside them (other versions of the story are about learning to wash them, but the principle is the same). It took a while for monkeys to copy each other, one at a time, and the speed of uptake was essentially linear and at a fixed rate until they reached the 100th Monkey. At this point, every monkey on the island, and every monkey on the three neighbouring islands all started the same trait, almost instantly. The point is: A species appears to be connected at some vibrational level to the extent that they share certain thought processes/notions. There is a tipping point (apparently this is the square route of 1% of the population pool / or 100 monkeys ) where once reached, this information is availiable to all. Almost as if an entire species are listening on the same multicast address.
Anyway, hope you find as interesting as I found your stuff. For more info see 100th Monkey at wikipedia.
Thanks, for sharing this observation, James!
--JaroslavTulach 19:29, 8 August 2012 (UTC)