'. '

From APIDesign

Jump to: navigation, search

Coolest NetBeans Plugin: MineSweeper! - 2014-04-15 12:35:00

MineSweeper is re-implementation of classical computer game available on each Microsoft Windows since the initial introduction in version 3.1. Surprisingly my kids (who otherwise spend hours with tablets) knew nothing about the game until...

I needed a demonstration for DukeScript technology that is using Java to code the application logic and HTML to render its UI. I decided to write a MineSweeper game as a basic demo. I've managed to execute the demo in a browser (via TeaVM), but today I achieved another milestone: the MineSweeper module is available for every user of NetBeans 8.0!

Get the module via Tools/Plugins or visit its plugin page and enjoy your productivity boost!

In case you are interested in trying the code yourself, here is a way to get the sources:

$ hg clone http://source.apidesign.org/html~demo/
$ cd html~demo/
$ hg up -C 3d99b96ffbd4
$ mvn install
$ cd minesweeper/
$ mvn -Pnbrwsr install
# generates target/minesweeper-1.0-SNAPSHOT.nbm

and the system generates an NBM (NetBeans module file) which can be installed into your NetBeans! Give it a try and let's make NetBeans better by using more DukeScript APIs! Don't forget that you can package the same application to run on Android or in a browser. Become a developer that can: Write once, run anywhere!

--JaroslavTulach 12:35, 15 April 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

OlderBlogPosts...

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

Image:ParadoxesCover.png

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

OlderBlogPosts...

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

OlderBlogPosts

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
buy