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!
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:
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.
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!
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.
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?
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 firstname.lastname@example.org and I share more details. Thanks in advance!
I've just finished integration of Codesnippet Javadoc Doclet into TruffleAPI 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.
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!
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!
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).
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 APIParadoxes 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?
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!
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):
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!
I've just converted Truffle to OSGi bundle with following simple script. As I was interested only in PolyglotEngine class,
I exported just the single package:
<?xmlversion="1.0"encoding="UTF-8"?><projectxmlns="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><artifactId>truffleosgi</artifactId><groupId>org.apidesign.demo</groupId><packaging>bundle</packaging><version>1.0-SNAPSHOT</version><dependencies><dependency><groupId>com.oracle.truffle</groupId><artifactId>truffle-api</artifactId><version>0.22</version><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><!-- I am interested only in PolyglotEngine --><Export-Package>com.oracle.truffle.api.vm</Export-Package><!-- list other packages that should be included in your bundle --><Private-Package>META-INF.*,com.*</Private-Package></instructions></configuration></plugin></plugins></build></project>
Since Sep 15, 2014 the MineSweeperNetBeans 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:
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!
Optimized the ahead-of-time compilation, so now the
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.
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 JavaFXiOS 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.
The more you fiddle with DEW and the more you alter (and save) the samples, the more we will help Java get Bck2Brwsr!
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.
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!
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 Bck2BrwsrVM 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...
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 goodAPI 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.
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!
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.
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.
"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.
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?
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.
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.
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.
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.
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.
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!
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.
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.