'. '

From APIDesign

Jump to: navigation, search

Marketing Version - 2023-06-11 05:26:00

There is a difference between MarketingVersion and engineering approach to versioning. Hear why: read more...

--JaroslavTulach 05:26, 11 June 2023 (UTC)

Do not Expose Deep Hierarchies! - 2022-09-24 05:39:00

Do not expose DeepHierarchy of classes when designing an API!

--JaroslavTulach 05:39, 24 September 2022 (UTC)

Using record on any JDK! - 2022-04-23 07:10:00

Do you like record or other modern Java language features? Would you like to use them on older JDKs? Then read about Frgaal - the retrofit compiler for Java.

--JaroslavTulach 07:10, 23 April 2022 (UTC)

Feeling the Pain! - 2021-12-22 06:02:00

It always helps when maintainers of a library or framework feel the pain of using it themselves. Then they become more open to address limitations of their own design. It's not users of (even of some obscure feature of) a library that shall "feel some pain every time they use it, to keep the usage as limited as possible". The maintainers should feel the pain. That helps them to get more Pragmatic and less academic!

--JaroslavTulach 06:02, 22 December 2021 (UTC)

2021: Code VSCode UI in Java - 2021-12-10 07:43:00

Seven years ago, in 2014 I wanted to unify UI of various IDEs around HTML (see below). However the motivation to do so was never compelling enough. Using Swing (or SWT) is more natural. Finally, in 2021 we found good enough reason: VSCode and its NetBeans based extension!


Since December 10, 2021 it is real: one can code HTML UI in Java and display it in VSCode as well as NetBeans. See PR-3349.

--JaroslavTulach 07:43, 10 December 2021 (UTC)

Bck2Brwsr 0.50: Ready for 2021 Technologies - 2021-08-01 19:48:00

For a while I ignored my Bck2Brwsr project, which I used to love, but recent back and forth shifts attracted me again to the area of Java and JavaScript interop. Originally I was hoping for a superior transpiler being created, but when I realized the goal isn't to cooperate, but compete, I decided to bring Bck2Brwsr transpiler into the 2021 age: it is still very restriced JVM, but it does support latest Gradle, it does support lambdas and it supports even JDK-11 string concatentation.

Read more at Bck2Brwsr 0.50 release page...

--JaroslavTulach 19:48, 1 August 2021 (UTC)

Apache Projects can Distribute GPLwithClassPathException components! - 2021-07-19 06:38:00

Thanks to our DirectAction - e.g. organizing a vote without a common consent - it has been decided that as of 2021 Apache projects can distribute GPLwithClassPathException components in their complementary binaries!

--JaroslavTulach 06:38, 19 July 2021 (UTC)

The Genetics of an APIDesign - 2021-06-29 06:29:00

The Genetics of an API design comes with own surprises: APIs shall not be copied, but only re-implemented. That's the paradox of copying an API!

--JaroslavTulach 06:29, 29 June 2021 (UTC)

Never forget to add GradleWrapper! - 2021-06-22 11:31:00

Including GradleWrapper.properties in each Gradle project follows the best practices: If you want to be sure your Gradle projects build in a year or two then make sure to always include the GradleWrapper and exactly specify the Gradle version!

--JaroslavTulach 11:31, 22 June 2021 (UTC)

Run on JDK8, use JDK11 APIs! - 2021-02-16 06:17:00

Do you want to run your application on JDK8, but use JDK11 APIs? That's traditionally done with a reflection. But there is a better way!

--JaroslavTulach 06:17, 16 February 2021 (UTC)

The Science of APIDesign - 2020-10-15 06:08:00

ScienceOfAPIDesign is possible and can be almost as sharp as the most accurate science of all times - geometry. To achieve such sharpness it is better/easier/more useful to focus on binary compatibility in Java rather than source compatibility. Enhancing language can mitigate many issues, but regular library designers (mere mortals) can't change their language. We can only learn what advises the ScienceOfAPIDesign offers and use them in our daily policies. Or don't use them (but preferably knowing why).

Anyone willing to join the quest on making ScienceOfAPIDesign better and sharper?

--JaroslavTulach 06:08, 15 October 2020 (UTC)

Adding DefaultMethods in a 100% BackwardCompatible Way! - 2020-09-30 06:10:00

I took a part in a tweetting about incompatibilities related to CharSequence.isEmpty() over the weekend and I asked myself a simple question: Is it possible to add a default method in a 100% binary compatible way? The newly written post provides the answer. Yes, adding default methods to interfaces in a 100% binary compatible way is possible at the end!

--JaroslavTulach 06:10, 30 September 2020 (UTC)

Micronaut Brings Compile Time Annotations to JavaEE Developers - 2020-07-22 04:56:00

Micronaut brings compile time annotations to enterprise Java programmers. That's great!

--JaroslavTulach 04:56, 22 July 2020 (UTC)

Helidon MP 2.0 supports GraalVM NativeImage - 2020-06-29 19:17:00

Helidon MP implements the MicroProfile specification based on various other standard JavaEE subspecifications including CDI. Getting Weld (the reference CDI specification) running on top of NativeImage is particularly tricky. Not only Weld dynamically scans for various annotations, but it also dynamically emits bytecode for its helper classes during runtime. Solving this required more insight into JavaEE than available among compiler engineers - not that I had it initially, but the close co-operation with Tomáš Langer (the Helidon lead engineer) helped us get started. Tomáš prepared various trivial CDI sample projects and I was then able to get them running on NativeImage by writing a dedicated WeldFeature. Once the initial road block was gone the Helidon team was able to move forward on their own and get their enhanced Weld running on top of NativeImage.

Helidon 2.0 was released on June 24, 2020. It's MicroProfile edition (including compatible CDI implementation) works with NativeImage.

--JaroslavTulach 19:17, 29 June 2020 (UTC)

Spreading Malware - 2020-06-02 15:31:00

At the end of May 2020 the GitHub guys announced a Malware attacking developer machines via NetBeans Ant based projects. Read more...

--JaroslavTulach 15:31, 2 June 2020 (UTC)

Twenty Years: Sun Microsystems Acquires NetBeans - 2019-10-20 06:07:00

PALO ALTO, Calif. - Oct. 20, 1999 - Sun Microsystems, Inc. today announced it has acquired NetBeans Ceska republika a.s., a Czech Republic joint stock company (NetBeans), by means of an asset purchase. NetBeans is a leading developer of cross-platform Java-based integrated development environments (IDE). NetBeans IDE products combined with products from Sun's acquisition of Forte Software, Inc., also announced today, will provide the million-plus Java Development Kit (JDK) software customers with software choices that range from entry-level offerings for individual developers and students to enterprise-class offerings for team development. Sun will also provide customers with the expert consulting and support services they need to dot-com their businesses.

--JaroslavTulach 06:07, 20 October 2019 (UTC)

My First Post on Medium is out! - 2019-08-30 08:47:00

My first blog post on medium - Improving performance of GraalVM native images with profile-guided optimizations is out. It rounds up my last few months efforts as the -Dgraal.PGOInstrument option is what I have been intermitently working on for at least last year.

--JaroslavTulach 08:47, 30 August 2019 (UTC)

Graal.js is in NetBeans - 2019-06-07 14:37:00

Graal.js version 19.0.0 has been integrated as the default scripting engine into Apache NetBeans 11.1. Read more...

--JaroslavTulach 14:37, 7 June 2019 (UTC)

Available on Safari Books Online - 2019-05-25 05:50:00

SafariOnline now hosts TheAPIBook. No more warez downloads!?

I had a presentation for my colleagues about GraalVM. GraalVM is about speed, but also about APIs. As a consequence some of my colleagues asked, why TheAPIBook isn't available for Oracle at https://my.safaribooksonline.com/ - I didn't know, but was curious to find out as well. I sent a note back in April to Apress. Why my Practical API Design is not being available on Safari? This week I've got an answer:

The reason it had not been available is because at the time the book published, we were not sending regular feeds to Safari. It was also at a time that pre-dates ePUBs being created as a part of our standard workflow (ePUBs are what SafariOnline requires). We had to create an ePUB from the existing PDF version of the eBook.

In short: TheAPIBook is now live on the https://my.safaribooksonline.com/

--JaroslavTulach 05:50, 25 May 2019 (UTC)

Four Years in OracleLabs - 2019-05-01 05:50:00

Time to recap as four years ago, on May 1st, I joined OracleLabs. What has happened during last year? I had fun with collecting profiles for further optimizations. I have fixed my first CVE and make Truffle meta-secure. I turned Java into Universal language. Read more about my FourthGraalAdventures...

--JaroslavTulach 05:50, 1 May 2019 (UTC)

Never Update (API) Tests! - 2019-01-24 04:05:00

Designing an API that shall last? Then Never update tests! The need to update tests is a sign of an incompatible change.

--JaroslavTulach 04:05, 24 January 2019 (UTC)

JDK11. OMG! Nashorn got Deprecated! - 2019-01-23 19:34:00

Nashorn, the so far default JavaScript engine of JDK got deprecated in JDK11. What are you going to do? Freak out? Jump out of the window? Switch to Rhino? Give up on Java completely and use NodeJS? No, use Graal.js! Here is how:

Don't hesitate and make the switch! Apache NetBeans has just switched today!

--JaroslavTulach 19:34, 23 January 2019 (UTC)

Forget Go! - 2018-10-01 13:21:00

Go is great. Are you seeking a low level OS language? Heard about Go & its benefits? Convinced, or just interested, and still searching? If the latter: Have you considered Java? Because OracleLabs GraalVM NativeImage turns Java into a system language!

Read about this alternative to Go.

--JaroslavTulach 13:21, 1 October 2018 (UTC)

Never hold a lock when calling a foreign code! - 2018-08-02 07:11:00

Fighting with deadlocks is hard in normal code. In case of APIs it is even harder. Yet, the advice is simple Never hold a lock when calling a foreign code. See the typical example rewritten to be deadlock-free in the dedicated deadlock page.

--JaroslavTulach 07:11, 2 August 2018 (UTC)

TenYears of the Practical API Design book - 2018-07-29 06:36:00

Ten years ago, on July 29, 2008, the Practical API Design book was published. Isn't that a date to remember and celebrate? Yeah, it certainly deserves at least a little note. Many things has changed over the last ten years...

The language that I used for most of the examples, Java, is no longer as popular as it used to be. It is no longer taught at basic university courses. It is no longer the choice of those who want to use good technology with all its three essential components (coolness, time to market and Cost of Ownership). Does that mean TheAPIBook content is no longer valid? Not that all! I always expected Java to evolve into something different - the language was just a tool - thus the core ideas still remain fresh and useful.

REST has grown way stronger in the last decade. When TheAPIBook was written, the term API was still reserved to all types of API (Protocols, FilesLayout, Dependencies, CLI, and of course signatures). The REST was just one of the types. I realized things has changed in 2014 when I received a question: How does the API economy impact the APIDesign? At that moment it was clear, the term API had been kidnapped by the REST guys. When regular people hear API they first and foremost envision web services! That is upside down, as network communication is just a part of the Art of Building Modern Software, but the expectations have shifted and one has to live with that.

Types went away and returned back. For a while it seemed that types were heading to unimportance with the decline of Java. It is true that the runtime characteristics of dynamic languages like JavaScript got on par over the years. Yet, it seems the types are striking back: TypeScript, Kotlin, etc. show that for certain tasks (like designing an API) having a type is an advantage. While I am able to design an API in a dynamic language, having types makes it all more convenient and alike to advises described in TheAPIBook.

I left the source of inspiration of TheAPIBook - I only contribute to the NetBeans Apache project in my spare time - as a result I had to find another organization to feed me with APIDesign mistakes. It is a strong suply, yet I believe the list of my achievements in the recent years allows one conclusion: It is possible to design an API as a service! I wish the impact of the Practical API Design book has been bigger: It is clear there is a lot of people struggling to design an API and it would really help them to avoid inventing the wheel. Many of the Practical API Design observations would help to avoid the mistakes I am seeing all around, but maybe it is not that easy to read, maybe it is the personalization that counts!

Don't you need a skilled API designer? Don't you want to improve your API Design skills with an entertaining game-like training? Talkback to me. Actively joining would be the best celebration of the 10th anniversary of the Practical API Design book!

--JaroslavTulach 06:36, 29 July 2018 (UTC)

Bck2Brwsr 0.23: Get Started via Gradle! - 2018-06-01 04:02:00

After few months the newest version of Bck2Brwsr VM is here. It contains:

It was quite a fun to write Gradle tasks together with Maven and build them by Maven.

Get started with README. Enjoy.

--JaroslavTulach 04:02, 1 June 2018 (UTC)

Git on Steroids: Fire Your Integration Guy! - 2018-05-22 07:50:00

Stefan asked who shall be responsible for integration in the MultiGitRepository setup? Should there be an integration guy? No, its 21st century and we know how to use Git, right? The right tool is called pull request!

As such fire your integration guy!

--JaroslavTulach 07:50, 22 May 2018 (UTC)

Git on Steroids: Local Collaboration Area - 2018-05-04 10:54:00

Turns out that one gets very useful MultiGitRepository#Appendix_A:_Local_Collaboration_Area: the master branch in each slave repository of the MultiGitRepository setup is in fact the best place for team members to collaborate without publishing the changes to the final integration destination.

--JaroslavTulach 10:54, 4 May 2018 (UTC)

Git on Steroids: Master Multiple Repositories - 2018-04-23 15:20:00

Let me introduces MultiGitRepository - aka Git on steroids to you. I have seen a lot of confusion when it comes to working with multiple repositories and keeping them in orchestration, but I believe it is not that complex. Everything we learned about distributed version controls applies. However this time it has to be applied on a completely new level!

Master your MultiGitRepository in few easy lessons!

--JaroslavTulach 15:20, 23 April 2018 (UTC)

Shocking: Default Listener Methods ain't Dangerous! - 2018-04-19 06:49:00

Using Default Listener Methods is perfectly fine! Those who remember my recent arguments against using DefaultMethods in APIs maybe the surprised by this statement, but it has to be made. Looks like using Default Listener Methods doesn't violate any practices of good API Design.

Thanks Dušane, for pointing that out!

--JaroslavTulach 06:49, 19 April 2018 (UTC)

Where's your Frontend? On a desktop!? - 2018-04-06 10:27:00

What does term Frontend mean to you? Tell us!

--JaroslavTulach 10:27, 6 April 2018 (UTC)

Don't rely on Jenkins and co. They hurt your API design skills! - 2018-04-04 14:16:00

Recently I observed an incompatible API change and I received following explanation: Everything is OK, my ContinuousIntegration server is still green! In a shock I decided to write a philippic against ContinuousIntegration.

If you have to fix your tests in a significant way after making a change to your API, then you should think twice. Maybe such change isn't really compatible enough to become smoothly part of your framework. There is probably a lot of code similar to your tests out there and there is nobody to fix them as part of your refactoring. Better to learn and invest in keeping a bit of BackwardCompatibility.

In some sense: When designing APIs, relying only on ContinuousIntegration is bad!

--JaroslavTulach 14:16, 4 April 2018 (UTC)

The IDE for DevOps! - 2018-03-15 11:18:00

Admins! DevOps! In a recent StackOverFlow developer survey the NetBeans IDE has been rated at 10.9% for Mobile Developers and 8.4% for System Admins/DevOps. It is weird, but it supports the feeling I had for a long time: NetBeans is the IDE for DevOps!


--JaroslavTulach 11:18, 15 March 2018 (UTC)

Turing speed: The Real Speed of a Language - 2018-03-09 08:40:00

Let me coin a new term: Turing speed - the real speed a programming language has. The speed of a general (e.g. Turing complete) computation. Read here why we need such classification.

--JaroslavTulach 08:40, 9 March 2018 (UTC)

Avoid usage of default methods in an API! Support Cluelessness! - 2018-03-05 11:32:00

Don't use default methods when designing your API. (For example when writing extensible visitor pattern) they just increase fuzziness and that is not what users of your API are searching for!

--JaroslavTulach 11:32, 5 March 2018 (UTC)

Singletonizer API Design Pattern - 2018-01-25 06:51:00

Recently I have successfully used the singletonizer API design pattern in Graal's Graph I/O API javadoc. The result ain't that bad, right?

--JaroslavTulach 06:51, 25 January 2018 (UTC)

Is Spring the Sole Reason why Java is Becoming the new COBOL? - 2017-12-18 11:46:00

Is there anything good on Spring that wouldn't be seen ridiculous by non-enterprise-Java users?

--JaroslavTulach 11:46, 18 December 2017 (UTC)

Type-safe Parsing of JSON without any Reflection - 2017-11-20 12:33:00

In need of compiling Java ahead-of-time? See jsonparse example showing a Maven project that can turn your Java code into self-contained, small (less than 5M) and effective code suitable for your microservice or lamda as a service setups. Thanks to SubstrateVM!

--JaroslavTulach 12:33, 20 November 2017 (UTC)

Apache HTML/Java API 1.5 has been released! - 2017-10-24 13:53:00

Hear the news! As of Oct 23, 2017, there is a release of ApacheNetBeans subproject: HTML/Java API. Hooray NetBeans continues to move on the Apache path! Next target? Apache NetBeans Platform...

--JaroslavTulach 13:53, 24 October 2017 (UTC)

Design for JDK9: Use PropertyChangeListener, get whole Swing with that! - 2017-08-14 16:59:00

Designing for JDK9 is going to be more and more important when JDK9 is finally about to be released. However the modular design of Jigsaw brings in new challenges. Hear my story where I tried to update a library to run on headless JDK9: because there is a hidden catch - once you try to use PropertyChangeListener you get whole AWT/Swing user interface with that!

Learn how to avoid that: DesignForJDK9!

--JaroslavTulach 16:59, 14 August 2017 (UTC)

Designing API as a Service? Yes, I can. - 2017-08-02 12:08:00

Two years ago I asked whether I can design Truffle API without being Domain Expert in the area of partial evaluation. Time has come to summarize my experience. I've written down list of eleven topics that I focused on mostly and (surprisingly even to myself) in most of the cases I was able to apply my APIDesign skills.

Read my TwoYearsWithTruffle essay to understand that once you are in a need of an API designer, you should talkback...

--JaroslavTulach 12:08, 2 August 2017 (UTC)

Bck2Brwsr 0.20 - the Radtouren 2017 Release - 2017-07-09 13:27:00

This version of Bck2Brwsr VM is called Radtouren 2017 version, as it has been prepared and released while our gang was bicycling in Korutany. Sleeping in a tent in camps, bicycling whole day, coding in a morning. What can be more fun?

Wanna transpile Java to JavaScript. Give Bck2Brwsr a try!

--JaroslavTulach 13:27, 9 July 2017 (UTC)

Don't Push and Pull! - 2017-06-16 13:54:00

It is hard to push and pull at once in real life and people tend to know it. Yet I have witnessed many attempts that try to put both approaches into the same API at the same time and pretend those are equal. Small advice from a former API designer: don't do it!

For a longer advice please see the pull vs. push essay.

--JaroslavTulach 13:54, 16 June 2017 (UTC)

Just Code - 2017-06-06 08:54:00

Is it JustCode that matters in a project or do projects need more? Is it necessary to have a bug tracking system or can we embed everything in the code? Is it better to keep snapshot of an API in the code or track it independently with additional tools?

Check my JustCode essay to see the benefits and drawbacks of both approaches.

--JaroslavTulach 08:54, 6 June 2017 (UTC)

Midlife Crisis of an API Designer - 2017-05-05 16:08:00

I have to admit I am currently at a midlife crisis. I dedicated my last twenty years to promotion of a proper API design. I wrote TheAPIBook, I tried to propagate the principles of good APIDesign and modularity wherever I could. However I am tired...

Because it is always the same. Why do I have ask: where is your Usecase? What this method is good for? What do you actually want to achieve with this method/class/type? Have you considered the difference between APIvsSPI aspects of your design? Do you have a unit test? Is your proposed change BackwardCompatible? Do you have an evolution story for your design? Is your solution optimized for your comfort or comfort of users of your API? And so on and so on... People should read TheAPIBook before attempting to design an API, but they don't and they make the same mistakes again and again.

I got so disgust that I feel sick, physically sick, when I have to think about API design. Last weekend Toni asked me to review an API he is creating and showed me what he has. I starred at him, then at the code and at him, etc. for three minutes before I could say a word. Then I had to apologize and describe my current MidlifeCrisis.

When I look at an API these days, all I see is the wasted potential the API could have, but it doesn't and never will, because the amount of investment I would have to do to educate the API stakeholder is so huge, that I just don't want to make it.

Anyway, if you have an API that you'd like me to improve, let me know. If I see real interest in proper API design my disgust and MidlifeCrisis may go away...

--JaroslavTulach 16:08, 5 May 2017 (UTC)

Advanced Injection in Jersey - 2017-03-15 05:27:00

I've just learned a new trick: proper way to do JerseyInjection. Maybe somebody finds it useful...

--JaroslavTulach 05:27, 15 March 2017 (UTC)

Codesnippet Doclet 0.20 Release - 2017-02-16 10:40:00

Enhance your Javadoc with Codesnippet4Javadoc version 0.20 which now supports special "coloring" for strings and comments.

--JaroslavTulach 10:40, 16 February 2017 (UTC)

My GeeCONPrague Keynote is Online! - 2017-01-04 03:44:00

My GeeCONPrague keynote is available online. Watch my metamorphosis yourself:

Once you survive it and get to 5th minute, you'll also see interesting demos showing how fast the GraalVM and Truffle can be. Thanks again GeeCON guys for giving me a chance to speak at your keynote.

--JaroslavTulach 03:44, 4 January 2017 (UTC)

CleanCode at OracleLabs - 2016-10-29 10:16:00

This is how we write CleanCode! At GeeCONPrague 2016 all OracleLabs speakers ware our classical outfit. The claim was that it helped us write CleanCode:

--JaroslavTulach 10:16, 29 October 2016 (UTC)

Keynote at GeeCON Prague - 2016-10-22 06:27:00

GeeCON has come to Prague and I had a the pleasure to do an initial keynote talk. It is so great when such conference comes to your home town! Thanks a lot dear, GeeCON organizers!

--JaroslavTulach 06:27, 22 October 2016 (UTC)

Beware of DefaultMethods - 2016-09-24 10:42:00

DefaultMethods is a new feature of JDK8 that we many cried for. Yet, they carry certain drawbacks with themselves. For example one can write a valid Java program that compiles and works on JDK7, but is broken on JDK8!

--JaroslavTulach 10:42, 24 September 2016 (UTC)

Distribute Non-distributable - 2016-09-12 08:55:00

AutoUpdate is a fine NetBeans technology that can help you distribute things may see non-distributable. Here is a small demo that shows how one can fix broken NetBeans 8.1 installation.

--JaroslavTulach 08:55, 12 September 2016 (UTC)

Swing's Bad Reputation - 2016-08-26 10:37:00

Is Swing's openness reason for its so bad reputation?

--JaroslavTulach 10:37, 26 August 2016 (UTC)

Become Polyglot by Learning Java! - 2016-07-22 05:33:00

I was invited to give a talk at CurryOn 2016 about Truffle called Become Polyglot by Learning Java!. It provoked tweets like: If you only watch one talk from @curry_on_conf, this one from @JaroslavTulach on Graal/Truffle is stunning. Here is its recording:

Or go to YouTube page.

--JaroslavTulach 05:33, 22 July 2016 (UTC)

Pitfalls of APIReviews - 2016-07-17 13:38:00

There are two pitfalls of an APIReview. Either there is no code to review or there is too much code already written. The too little code case can easily be fixed. As Linus Torwalds use to say: Talk is cheap. Show me the code!

However what to do when APIReview brings in complex, complete solution with code almost ready for integration? Isn't that insulting? What kind of review one is supposed to perform then? Claim that the solution is completely wrong? That won't make the author happy. On the other hand coming for an architecture advice with fully working version isn't polite to reviewers either. Shall we read it as: Look how great I am! Approve the APIReview now!

Maybe there is a way to handle such review as well. But it remains to be seen if it works. Wish me luck.

--JaroslavTulach 13:38, 17 July 2016 (UTC)

Test your APIs Easily with Maven SigTest Plugin - 2016-07-15 17:52:00

The NetBeans API & Maven community (e.g. me and Miloš Kleint) is proud to announce the immediate availability of sigtest-maven-plugin. Signature testing has never been easier: just follow the tips on the SigTest main page and you'll never make an incompatible change since then!

Read TheAPIBook and let NetBeans SigTest Maven plugin look over you and make you great API designer! Enjoy!

--JaroslavTulach 17:52, 15 July 2016 (UTC)

Make Your Builder Whine! - 2016-06-26 20:00:00

Another variation on the topic of builder patterns. A builder that can track N essential attributes and whine (by throwing a checked exception) until all of them are specified.

Learn how to make your builder whine!

--JaroslavTulach 20:00, 26 June 2016 (UTC)

Chameleon Builder: Changes its Return Color! - 2016-06-16 09:34:00

Hear the news! A new creature of the API design patterns rare species has been discovered. It looks like a builder pattern, but it ducks like something else. If you take a closer look you'll find out it is a chameleon! It changes its return type depending on its state.

Do you want to protect your own builder like a chameleon? Follow this link and learn the trick!

Once you discover the beauty, you'll not stop until you get your own chameleon builder into your own design!

--JaroslavTulach 09:34, 16 June 2016 (UTC)

Builder to Tame Your Checked exception! - 2016-06-13 08:00:00

Here is a nice extension to the builder pattern that allows one to control whether the final build() method throws a Checked IOException or not.

Enjoy this new addition to the list of APIDesignPatterns.

--JaroslavTulach 08:00, 13 June 2016 (UTC)

Boost Your Career: Become an API Tester! - 2016-06-06 08:13:00

Motto: the easiest way to learn something about a code base is to fix bugs. The easiest way to learn something about design API is to join an APIUsabilityStudy!

There are many reasons why you should care about the Truffle framework (please check the changelog of just released version 0.14 to learn more), but the most important one is related to API Design and your career:

I need API testers! I need to organize a usability study of the Truffle API and I need developers to perform it. How can you help?

We have prepared five easy tasks: use Truffle to invoke a code in Ruby, JavaScript, R, exchange data between Java and one of those languages using Truffle interop, etc. In addition to that we ask you five questions: What did you like/dislike? What should we improve, etc.? Overall, the whole study should be easy and entertaining. You can learn something new (e.g. Truffle) and even earn some money.

Originally I wanted to repeat the previous success of netbeans:Html4JavaUXStudy2014, but the then used service is no longer available due to small demand. Understandable, but a shame! I know the demand for API related courses is low (I do one once a few years), but it is always very valuable to seek an advice when it comes to API - the on-line API usability study was really great idea! Alas, we need to organize it ourselves.

Are you interested to help us? If your want to be an API tester for a few hours, please write to my email practical@apidesign.org and I share more details. Thanks in advance!

--JaroslavTulach 08:13, 6 June 2016 (UTC)

Write Business Logic First, Choose UI Later! - 2016-05-09 03:45:00

The ControlsJS guys decided to port my MineSweeper game to their rendering technology and make it available at iOS AppStore:


This shows how extremely portable applications written with Html4Java APIs are! In fact you can write your application code first and because it is completely independent from the UI, you can completely revamp the UI later.

Isn't this the flexibility we always wanted? Read the whole story...

--JaroslavTulach 03:45, 9 May 2016 (UTC)

Run JUnit in Your (Java Plugin-less) Browser! - 2016-04-30 07:24:00

Bck2Brwsr 0.19 comes with many little improvements and one new feature: it can execute JUnit in the browser!

  • Better support for Annotation - so good that bck2brwsr can now execute JUnit tests
  • Support for all classes from java.util.concurrent package, so JUnit runs without problems
  • Switching to version 2.1.0 for RetroLambda
  • More robust generated JavaScript file - doesn't override already defined classes
  • Uses version 1.3 of Html4Java API.
  • Record name of an OSGi bundle to be used when Maven coordinates are missing like in JUnit case
  • Don't convert Date objects to current time millis
  • Use boolean.valueOf() to simplify mixing of boxed and unboxed booleans
  • Perform more conversions before returning Java value to JavaScript from a Java callback
  • Launcher.createBrowser can specify its own page
  • Make sure class cast exception contains the same message as produced by JDK
  • Convert undefined value read from arrays into null
  • Convert content of array properly before entering JavaScript
  • Turning the bck2brwsr VM into an OSGi bundle
  • Introducing vmtest.precompiled=<regexp> property to verify that bck2brwsr generated resources are really used
  • Don't include VM in VMTest initialization, let it be loaded on demand
  • System.exit terminates associated launcher
  • eval(JavaScriptResource) as string to prevent double obfuscation
  • Don't report warnings when generating minified version of bck2brwsr libraries

Get the bits from the Maven central repository!

--JaroslavTulach 07:24, 30 April 2016 (UTC)

Giving Up on Apple AppStore - 2016-04-09 06:13:00

My MineSweeper application available from AppStore is gone. Apple wants me to pay remedies every year! For what!? Apple has no cost distributing my application. I am giving up. If somebody wants to distribute my MineSweeper, please go on, but I am giving up - giving up on Apple.

--JaroslavTulach 06:13, 9 April 2016 (UTC)

HTML/Java API 1.3 is Released! - 2016-04-08 03:33:00

I'd like to announce that the new version of HTML/Java API - e.g. 1.3 is ready for usage. The javadoc is at http://bits.netbeans.org/html+java/1.3/ - and the bits has been uploaded to Maven central.

HTML/Java 1.3 comes with many improvements that will make your life easier and enlarge the options you have when mixing Java and HTML. Let me quote the Javadoc:

Model classes can have per-instance private data. Model classes can generate builder-like construction methods if builder prefix is specified. Property.mutable() can be false to define a non-mutable (almost constant) property. That in case of Knockout bindings means: the property is represented by a plain value rather than an observable in the JavaScript object. The JavaFX presenter can be executed in headless mode - just specify -Dfxpresenter.headless=true when launching its virtual machine and no window will be shown. This is particularly useful for testing. OSGi headers are now enterprise OSGi ready. Switched to minified version 3.4.0 of knockout.js. Better support for recursive @Model definitions. New module org.netbeans.html:xhr4j provides implementation of Transfer with technology identifier xhr4j - this module can be used to workaround limitations of CORS by handling the OnReceive connections in Java.

--JaroslavTulach 03:33, 8 April 2016 (UTC)

Uncheck Your Checked exception! - 2016-04-06 16:26:00

Checked exceptions are Java invention and many like to argue that they are the worst invention ever. I like exceptions and I like Checked exceptions. Today I am ready to explain why!

Do you believe people should only use runtime exceptions? That checked exception add too much overhead? Then you are wrong!

I agree that the concept of checked exceptions in Java has some drawbacks, but I am ready to explain how to overcome the restrictions and uncheck your checked exception whenever you want. Enjoy!

--JaroslavTulach 16:26, 6 April 2016 (UTC)

API Design under Attack! - 2016-02-10 19:54:00

Today my colleagues from NetBeans noticed that my website - wiki.apidesign.org is under attack. Yes, since Jan 16, 2015 there were more than 5000 randomly modified pages. Maybe my talk in Grenoble was so popular that it attracted that much attention!?

Anyway I had to revert back to older copy of the database and re-apply my edits manually. Not everything looks the same as it did before, but hopefully no texts are lost.

In any case, I disabled ability to edit the pages. If you want to talk to me, use twitter and reference my handle: @JaroslavTulach

--JaroslavTulach 19:54, 10 February 2016 (UTC)

Snowcamp in Grenoble gave Bck2Brwsr 10x Speed Up! - 2016-01-28 07:56:00

Bck2Brwsr version 0.17 is faster. Ten years ago nobody would imagine dynamic languages could get as good performance as they have now. The feeling that JavaScript just can't be fast is presumably present in many of our souls. The truth is, it can be relatively fast - not as fast as Java as my experiment with Sieve of Eratosthenes shows, but pretty damn fast. Certainly not an excuse to be ten times slower than HotSpot (which was the previous state of Bck2Brwsr).

The daily work on Truffle compiler team and the time I got when traveling from Snowcamp at Grenoble gave me a chance to speed Bck2Brwsr up. The sieve being a nice - e.g. small and focused - benchmark. Originally the algorithm couldn't be finished in a reasonable time when running on old version of Bck2Brwsr, but knowing what optimizing compilers seek for, it was relatively easy to speed it up ten times.

With great pleasure I announce that Bck2Brwsr, the most complete Java VM in browser (that can run Javac as shown by Dew project) has been sped up many times being at most three times slower than HotSpot. Given the primary goal of Bck2Brwsr is modularity and not speed, I consider it a good sped up even knowing there is a room to make it even faster.

Enjoy the Bck2Brwsr 0.17's speed!

--JaroslavTulach 07:56, 28 January 2016 (UTC)

Improve Javadoc of Your API: Stop showing crappy code samples! - 2015-12-30 15:59:00

I've just finished integration of Codesnippet Javadoc Doclet into Truffle API and the result is great: we found out that one of the samples (actually the first one that I tried) was not compilable!

If you care about Javadoc of your API, consider using Codesnippet doclet too!

Btw. it surprises me I am the first one who created something like this! Showing snippets in documentation is so common. But maybe it is the same issue as with TheAPIBook - it was the first book that ensured all the code samples are compilable by extracting them from real source code (using similar infrastructure as Codesnippet doclet provides). And it worked - while Errata of every book is full of comments about incorrect code samples, there is none for TheAPIBook.

Do your API a favor: use Codesnippet Javadoc Doclet and make your code samples real!

--JaroslavTulach 15:59, 30 December 2015 (UTC)

MineSweeper 3.0 for Your iOS Device. The Christmas Thriller Edition! - 2015-12-18 05:07:00

In September 2015 I decided to update the MineSweeper on AppStore to version 3.0. With a great pleasure I can announce that now, on December 18, 2015 the version is alive! Why it took so long?

Well, Apple's itunesconnect website is unusable - it isn't enough to upload new version of your application and press button Request Review. The user interface is completely messed up and hidden to make the process as obscure as possible. As a result MineSweeper was laying on the AppStore for six weeks before I found the right address (also pretty hidden) to complain at and was explained what is wrong.

Then, of course, the usual reject. This time it was due to Using images that resemble(!) Apple logo - yes, the MineSweeper is using Safari and iOS icon (check the on-line version). But these icons were present in the previous AppStore version as well. And version 2.3 was approved! Clearly the whole review process suffers from the human factor of the reviewer. What some reviewers find appropriate isn't appropriate for others.

How can I know this is a human factor? Because the new version of the MineSweeper of iOS comes with three translations - English, Czech and German (thanks to Toni) - and I am sure the reviewers checked just the English one. If the check was automatic - e.g. some scan through the binary - my submission might have been rejected again. Thankfully it wasn't. It is great we made it before Christmas, as next week the whole AppStore team is going for a vacation...

Here are the changes against standard MineSweeper source code to make the application releasable on the AppStore this time: https://github.com/jtulach/minesweeper/compare/9fc7970496a...0d6984c73

Enjoy version 3.0 of Fair MineSweeper on AppStore. Visit https://itunes.apple.com/us/app/fair-minesweeper/id903688146 to play fair!

--JaroslavTulach 05:07, 18 December 2015 (UTC)

Introducing Sigtest into Your Project Workflow! - 2015-11-23 10:34:00

Truffle project is using Sigtest since today. I am maintaining the Truffle APIs since May, 2015 and I was applying my best knowledge and skills to design it properly. However I have to admit, I was operating in a blindness. Without having tests it is hard to decide whether your code change doesn't break your product. When designing API, it is important to know whether a change is or isn't backward compatible. Without a tool like Sigtest, it is almost impossible to do that manually!

Every project that designs an API needs an automated compatibility check. Learn what it takes to introduce such checks into your project by reading about the TruffleSigtest showcase!

--JaroslavTulach 10:34, 23 November 2015 (UTC)

OracleLabs in Prague is Hiring! - 2015-10-07 07:44:00

OracleLabs has a team in Czech Republic and is looking for new candidates to expand it. Innovation is feeding us, but that doesn't mean you have to be a scientist. We have enough clever people - we need also somebody to work!

In case you are interested in conquering the world with the fastest (J)VM on the planet backed by a strong tooling (based on NetBeans) write to me.

--JaroslavTulach 07:44, 7 October 2015 (UTC)

Can Java Speed Ruby up? Yes, ten times! - 2015-10-02 12:28:00

Speed of Ruby has never been great. There were many attempts to improve it, but none delivered on its promise. All failed, but one! JRuby implementation running on top of JVM spiced with a bit of Truffle and Graal is in fact ten times faster than standard Ruby version.

Watch this video to see how can Java and its virtual machine help those other poor and slow languages!

--JaroslavTulach 12:28, 2 October 2015 (UTC)

Speaking at JDD in Krakow - 2015-09-25 09:31:00

I'll be speaking at JDD in Krakow in middle of October. In case you have a Java related message to deliver to the JDD galaxy, leave it here. I'll do my best to deliver it.


I enjoyed Krakow JDD conference in 2013 and based on my experiences I wrote the languages essay. Now I am invited to speak at JDD 2015 about Truffle and Graal and while there I am also going to do a workshop about DukeScript.

If you have a message that I should share with visitor's in Krakow, leave it here:


--JaroslavTulach 09:31, 25 September 2015 (UTC)

Truffle Debugging in NetBeans 8.1 - 2015-09-11 14:10:00

Debugging any Truffle language is now quite easy in NetBeans 8.1! Check the video:

--JaroslavTulach 14:10, 11 September 2015 (UTC)

HTML/Java version 1.2.1 has been Released! - 2015-09-02 06:16:00

Cross platform UI library called HTML/Java API (which is developed by the NetBeans project) is proud to announce that version 1.2 has just been released on Maven central. See javadoc to find out what is new in this version!

The project is also glad that binaries of the new HTML/Java version 1.2 are now included in forthcoming NetBeans 8.1 release making it easy to develop wizards as well as components and dialogs in a cross-platform manner (e.g. able to run in NetBeans platform applications, IDE, Eclipse RCP, plugin-less browser and thanks to adoption by DukeScript project also on iOS and Android).

HTML/Java API is the heart of Java that is written once, and displayed everywhere!

--JaroslavTulach - HTML/Java inventor 06:16, 2 September 2015 (UTC)

Design with Truffle. Get Debugger for Free! - 2015-06-24 16:04:00

Truffle - a modern way to write AST interpreters - gives you not only speed, but also debugger for free:


The picture shows NetBeans debugger stopped in middle of simple language (an artificial language used for demo purposes) method. NetBeans knows nothing about simple language (that is why syntax coloring is missing), but as NetBeans understands the Truffle AST, it can still provide enough valuable information in the debugger.

Please note that the name of the method is properly recognized and shown on top of the stack. Variables a and b and their values are properly shown as well.

Designing your own language? Do you want to spend time writing a debugger? If not, use Truffle and you'll get your debugger for free!

--JaroslavTulach 16:04, 24 June 2015 (UTC)

Enforcing Proper API Usage by Law - 2015-06-15 09:21:00

Enforcing proper usage of an API is hard. One needs to strive for clarity, one can invent engineering solutions to the problem, but at the end clever hacker always find a way around it. But there is a cure: Let's choose our licenses wisely and scare the hackers with legal actions!

At the end it could also solve the famous sun.misc.Unsafe issue...

--JaroslavTulach 09:21, 15 June 2015 (UTC)

Is localizing an API bad idea? - 2015-05-31 07:48:00

What is the relation between I18N and API design? Should API be internationalized and localized?

--JaroslavTulach 07:48, 31 May 2015 (UTC)

Java Modularity in the Context of JavaScript - 2015-05-29 04:10:00

Obfuscation per library is quite common in JavaScript and it results in faster download times, sharing modules between different applications and easier processing of the obfuscated files. Shouldn't something similar be done in Java?

Yes, it should. And it has been done! Here is description of design and implementation of Obfuscation per JAR file for Java (in a [[Bck2Brwsr|browser).

--JaroslavTulach 04:10, 29 May 2015 (UTC)

API Design as a Service - 2015-05-17 10:26:00

Domain Expert is a person who has knowledge of a particular system. With such knowledge it may seem easy to design APIs for the domain. However without understanding the API Paradoxes the quality of such API may not be high. It is likely going to cover the domain field, but the API usability or readiness for evolution will very likely suffer (unless such Domain Expert reads TheAPIBook first).

However can it work backwards? E.g. can one be just an API expert and then design good enough API without appropriate domain knowledge?

I am now participating in an experiment that will check that. OracleLabs guys asked me to help them design Truffle interoperability APIs. I do understand bit about Truffle, but certainly I am not a Domain Expert, yet I am supposed to design something as complicated as API to allow mixing of languages: imagine part of program written in Ruby, part in JavaScript, part in Java with objects floating between these languages without any borders!

This is a new situation for me: In case of NetBeans or in case of HTML/Java APIs, I was also the architect of the system. I knew it by heart. Now I barely understand how Truffle works and what makes it the fastest execution system for dynamic languages. My biggest fear is that I will design something that will be inherently slow.

On the other hand, I am not yet damaged with the expert knowledge. I can still see the system with new comer eyes - just like you, users of Truffle will. As such I can perform a usability study on me, at least initially.

If I can design easy to use APIs for Truffle, then I can create a perfect API facade around everything! Soon we'll have a chance to see whether one can be good API designer without being real Domain Expert. Soon we'll find out if API Design can be offered as a service!

Update from summer 2017: After TwoYearsWithTruffle I'd say there is a lot of things one can do to design API as a service without being a Domain Expert.

--JaroslavTulach 10:26, 17 May 2015 (UTC)

JavaScript is the x86 of the Web - 2015-04-22 07:00:00

Brendan Eich, the inventor of JavaScript: I said 'JS is the x86 of the web' ... the point is JS is about as low as we can go..., here is a video to document the current JavaScript situation together with showing excellent demos as a proof:

--JaroslavTulach 07:00, 22 April 2015 (UTC)

JavaScript is a New Assembly Language - 2015-04-05 21:02:00

Ever felt JavaScript is your carrier path? Well, maybe you should re-think you future! JavaScript is just another assembly language!

--JaroslavTulach 21:02, 5 April 2015 (UTC)

NetBeans History: University Beginnings - 2015-03-20 16:04:00

The original name of the project was Xelfi and it started at MatFyz faculty of Charles University in middle of 90-ties. However it was so successful that it had to turn into something as successful as NetBeans. In case you are satisfied with your IDE, consider reading about its root...

--JaroslavTulach 16:04, 20 March 2015 (UTC)

Gradle belongs to Stone Age! - 2015-03-15 15:56:00

My friends keep talking about the greatness of Gradle. It is hard to stand it, especially knowing there is a significant flaw introduced in Gradle's core.

The flaw is so huge that I rank Gradle along Ant. Into Ant-age!

--JaroslavTulach 15:56, 15 March 2015 (UTC)

ConfigurationObject Pattern in Java - 2015-02-22 12:44:00

ConfigurationObject pattern is quite common in many JavaScript libraries. Do you know what is the best way to express it in Java? Check my essay that compares four different ways and analyses their impact on API designer and especially API users.

--JaroslavTulach 12:44, 22 February 2015 (UTC)

Final interface. Finally Done Right! - 2015-02-04 16:53:00

Maybe there is nobody interested in final interface API Design Pattern anymore! Now when there is JDK8 with extender methods people may always mitigate bad design (e.g. using final interface at all) by adding methods with default bodies. Still I found it important to cover this pattern in my API Design Patterns Collection.

Let's me guide you through the short and incomplete history of final interface design pattern with small excursion to JDK's own itches and specifics of designing for OSGi to finally describe how to do final interface pattern right!

Let you find such description useful!

--JaroslavTulach 16:53, 4 February 2015 (UTC)

Can Real Threads be Brought to JavaScript? - 2015-01-22 09:52:00

What it would take to bring Java like threads into JavaScript (via Bck2Brwsr VM)? Here is my [[1]]!

--JaroslavTulach 09:52, 22 January 2015 (UTC)

Bck2Brwsr @ 0.13 Released - 2015-01-12 09:27:00

Bugfix release of Bck2Brwsr 0.13 is out and it powers another classical game: fifteen. Give it a try!

--JaroslavTulach 09:27, 12 January 2015 (UTC)

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 \
# answer few questions...
$ cd nameofyourproject
# run on desktop
$ mvn process-classes exec:java
# run in a browser
$ mvn -Pbck2brwsr clean package bck2brwsr:show

Supporting Bck2BrwsrBlobURLs so one can display images available as in JAR resources.

Happy Year 2015 and please help me get Java Bck2Brwsr!

--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

Bck2BrwsrLibraries can now be published as Maven Artifacts which greatly reduces edit/compile/run time.

--JaroslavTulach 05:21, 7 December 2014 (UTC)

Wrap Your JAR as OSGi Bundle via Maven Easily! - 2014-11-29 13:07:00

See the tutorial at OSGiWrapper.

--JaroslavTulach 13:07, 29 November 2014 (UTC)

Bck2Brwsr and Images as Resources - 2014-10-30 01:19:00

Blob URL support has been implemented for forthcoming version of Bck2Brwsr 0.12. Now you can easily access images packaged as resources in your JAR files and obtain their browser valid URL.

--JaroslavTulach 01:19, 30 October 2014 (UTC)

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

DukeScript has been awarded a Duke Choice Award! Here is picture of Toni Epple and me holding the Duke Choice Award on Sep 28, 2014:


Long live Java and HTML on every device (iOS, Android and co.)!

--JaroslavTulach 17:37, 29 September 2014 (UTC)

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:

InvokeDynamic should have never been added to Java and should be removed from the specification. Read why...

--JaroslavTulach 12:50, 25 September 2014 (UTC)

Lambdas Go Bck2Brwsr! - 2014-09-15 17:48:00

Bck2Brwsr 0.10 has just been released. The most important thing to note is that it handles JDK8's lambdas. See the illustrative video:

The JDK emulation library is still based on JDK7, so don't expect your streams & co. code to run. I'll update to JDK8 after JavaOne2014. Meanwhile enjoy lambdas in your own APIs!

--JaroslavTulach 17:48, 15 September 2014 (UTC)

Play MineSweeper to Become iOS, Android, JavaFX &amp; co. Developer - 2014-09-15 10:57:00

Since Sep 15, 2014 the MineSweeper NetBeans integration can be used as a starting point to develop own DukeScript applications. Just press the Develop button and a new project wizard will be opened as following picture shows:


--JaroslavTulach 10:57, 15 September 2014 (UTC)

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

And don't forget you can use NetBeans to develop such applications yourself! Install DukeScript NetBeans support.

--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

And don't forget you can use NetBeans to develop such applications yourself! Install DukeScript NetBeans support.

--JaroslavTulach 05:17, 31 July 2014 (UTC)

Japanese Translation is Real - 2014-07-17 06:51:00

Cover of Japanese translation of TheAPIBook. I am amazed, the book is about 30% shorter, yet is seems to contain all the content of the original one!


Great work Yoshiki!

--JaroslavTulach 06:51, 17 July 2014 (UTC)

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 described in the official DukeScript getting started document.

--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;

which is shorter and more human readable. However I doubt the V8 virtual machine sees any benefits - I think the final native code remains the same. But at least the debugging of the generated JavaScript code is now easier - there is less Step Over invocations and it mimics more closely the original Java source.

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.

Can ObfuscatePerLibrary - e.g. each JAR gets compiled ahead-of-time into its own JavaScript file, which can be shared between many applications.

--JaroslavTulach 06:34, 10 June 2014 (UTC)

Podcast related to Japanese Translation - 2014-06-02 18:45:00

Japanese translation announcement: --JaroslavTulach 18:45, 2 June 2014 (UTC)

MineSweeper on iOS - 2014-05-21 14:13:00

Thanks to IBrwsr I managed to run my favorite game on my iPad! Why don't you write applications that run on every device, yet?


--JaroslavTulach 14:13, 21 May 2014 (UTC)

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

By lowering profile of our libraries, we can make them more ready for JDK8. Here is few patterns one can use to adopt own library to JDK8 profiles.

Lower your profile, let (your library usage) get higher!

--JaroslavTulach 11:40, 23 March 2014 (UTC)

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.

Enjoy and give DukeScript (the JavaScript, the way it was meant to be) a try!

--JaroslavTulach 14:27, 20 March 2014 (UTC)

Debug Mixed Java/JavaScript Applications - 2014-02-20 15:53:00

Before Nashorn (the JDK8 JavaScript engine) performing calls between Java and JavaScript was a pain. Especially when it came to debugging. But now, one can completely freely mix Java and JavaScript inside of a single thread and still be able to debug and inspect the slightest details of Java as well as JavaScript stack frames.

See video showing the power of the synergy between NetBeans 8.0 and Nashorn!

--JaroslavTulach 15:53, 20 February 2014 (UTC)

Avoid Synchronization Problems - 2014-02-14 16:24:00

Don't let your objects escape from your methods! As suggested on page 193.

--JaroslavTulach 16:24, 14 February 2014 (UTC)

It, this and that: Optimizing for Cost of Ownership - 2014-02-11 10:53:00

As paragraph on page 154 shows, it is not easy to find out what a meaning of it, this and that may be. Thanks Yoshiki for contributing this first Errata for Chapter 9!

--JaroslavTulach 10:53, 11 February 2014 (UTC)

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:

Page 363

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

The Japanese translation of my book has been in progress for several months. Recently I've been asked by Yoshiki to write a preface.

I wrote one and I tried to express how wonderful experience it had been to participate in the Japanese translation. I believe the Japanese version of my book will be great.

Thanks Yoshiki for your work. Dear (Japanese reading) readers, enjoy!

--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

I've managed to prototype a way to share UI between two rich client platforms. These days it is popular to use HTML, so I did it. However in addition to that I managed to remove all need for JavaScript. Design in HTML and code your application logic in Knockout4Java.

See how!

--JaroslavTulach 18:01, 21 December 2013 (UTC)

JavaFX for iOS via NetBeans - 2013-12-10 12:42:00

I am pleased to announce there is now a way to develop applications for iOS using your favorite language (I mean Java) and your favorite development IDE (I mean NetBeans).

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.

Enjoy JavaFX on iOS!

--JaroslavTulach 12:42, 10 December 2013 (UTC)

API Design Guidelines - 2013-12-02 09:30:00

I have discovered a nice checklist of guidelines considered good for API design.

--JaroslavTulach 09:30, 2 December 2013 (UTC)

Cloud IDE for Kids - 2013-12-02 08:48:00

Scratch is getting better and better. If you have not done that yet, give it a try!

--JaroslavTulach 08:48, 2 December 2013 (UTC)

The Smallest Linux JDK - 2013-11-27 15:12:00

The profiles support is coming for JDK8. Not only it is coming, it works! In case you are searching for a small Java, give profiles a try. They are easy to start with.

--JaroslavTulach 15:12, 27 November 2013 (UTC)

DEW - Java Meets Web with Your Help! - 2013-10-28 16:56:00

I'm proud to announce DEW - the development environment for web (of course in Java). I am tired of observing JavaScript being on the rise while pretending it is more than just a script language. The real language is Java and it does quite well with HTML. Check DEW here: http://dew.apidesign.org/dew/ and you will not regret!

The more you fiddle with DEW and the more you alter (and save) the samples, the more we will help Java get Bck2Brwsr!

--JaroslavTulach 16:56, 28 October 2013 (UTC)

Pervert Your Language to Become a Better Programmer - 2013-10-16 13:02:00

Language that you speak and write defines what you can think and reason about. The worse language you can use the better programmer you are. Right?

--JaroslavTulach 13:02, 16 October 2013 (UTC)

Do You Know What a WeakReference Can Do to Your API? - 2013-10-11 08:50:00

References and WeakReferences play important role when designing an API contract or building a framework. Are you sure you use them properly? Read about problems we had when messing with WeakReferences in the Lookup API.

--JaroslavTulach 08:50, 11 October 2013 (UTC)

Maven and Bck2Brwsr 0.8 - 2013-09-29 12:22:00

I've just updated instructions to use bck2brwsr 0.8 from command line. Me and Jonathan Fuerth also verified that the Bck2Brwsr Maven archetype can now be used in Eclipse.

Nothing can stop us from bringing Java Bck2Brwsr!

--JaroslavTulach 12:22, 29 September 2013 (UTC)

Can Deserialization Change Value of a Final Field? - 2013-09-23 16:58:00

Deserialization can change value of a final field. See the code snippet to understand how. 1st lesson learned at JavaOne2013.

--JaroslavTulach 16:58, 23 September 2013 (UTC)

The Art of Writing Equals in Object Oriented Languages - 2013-09-06 08:53:00

Do you think you know how to write equals? Are you sure? Take your time. Still sure? Check this example to verify.

--JaroslavTulach 08:53, 6 September 2013 (UTC)

Use the Debugger, Stupid! - 2013-08-20 09:17:00

Debugger is a very useful tool. I greatly recommend it to everyone who asks stupid questions on mailing lists and reports vague bugs into bug tracking systems. If your application does not work: use the debugger! Read here to learn how.

--JaroslavTulach 09:17, 20 August 2013 (UTC)

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

Knockout4Java takes the best of two words: The type safety of Java and Knockout.js ability to alter any HTML page in any browser. Write your models in Java (using JSON4Brwsr library) and render them as HTML with the help of Knockout4Java!

--JaroslavTulach 21:32, 16 May 2013 (UTC)

Bck2Brwsr 0.7 Released! - 2013-05-09 07:50:00

Write applications once and deploy them to FXBrwsr as well as Bck2Brwsr:

--JaroslavTulach 07:50, 9 May 2013 (UTC)

Introducing FXBrwsr - 2013-04-30 09:25:00

FXBrwsr is an attempt to give people the rendering power of HTML (via Knockout.js) and the benefits of HotSpot Java VM. As the Twitter example shows, it is then easy to deploy the application to run Bck2Brwsr.

--JaroslavTulach 09:25, 30 April 2013 (UTC)

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


--JaroslavTulach 21:00, 14 April 2013 (UTC)

Cimrman's Planning - 2013-03-19 15:10:00

Short introduction to accurate, agile, modern, reliable, flexible, optimistic, forward looking, experience based, projective planning methodology.

--JaroslavTulach 15:10, 19 March 2013 (UTC)

Javadoc for Coding for Your Browser Published! - 2013-03-01 09:11:00

I've just set a job up to generate Bck2BrwsrJavadoc. Anyone wants to design a library for the browser?

--JaroslavTulach 09:11, 1 March 2013 (UTC)

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

A theoretical observation about a hammer with application to real world scenario as well as software user interface design.

--JaroslavTulach 13:37, 12 November 2012 (UTC)

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.

Hopefully not only MatFyz guys find the essay useful.

--JaroslavTulach 02:00, 7 November 2012 (UTC)

Is Java a Language or a Framework? - 2012-10-18 09:06:00

Just a few thoughts about the difference between language and a framework (plus a wish how Java should evolve).

--JaroslavTulach 09:06, 18 October 2012 (UTC)

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 asked Clay to select cover that would somehow reflect my relation with my home and I am glad he decided to use painting of Josef Lada - a painter of my childhood.

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


--JaroslavTulach 07:00, 27 September 2012 (UTC)

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)

How Strict a Backward Compatibility Should Be? - 2012-07-31 12:13:00

Here are some thoughts on the difference between 100% BackwardCompatibility and their slightly more practical variants.

--JaroslavTulach 12:13, 31 July 2012 (UTC)


Enums in APIs - 2008-07-16 14:18:00

An user of an enum might want to ensure he has processed all its fields. This can be problematic when the user doesn't own the enum, such as in an API.

--AndreiBadea 14:18, 16 July 2008 (UTC)

Question on classes and interfaces - 2008-07-15 09:33:00

Someone asked: I guess that, roughly, a client API should use abstract classes while a support/provider API should use interfaces?

To which I responded...

--JesseGlick 09:33, 15 July 2008 (UTC)

Personal tools