Blogs:JaroslavTulach:Practical Design

From APIDesign

(Difference between revisions)
Jump to: navigation, search
Current revision (05:26, 11 June 2023) (edit) (undo)
 
(46 intermediate revisions not shown.)
Line 3: Line 3:
<startFeed />
<startFeed />
-
==== Is [[C]] Better than [[C++]]? [[Scala]] Rules! ====
+
==== Marketing Version ====
-
Recently I've noticed an interesting [[trait|article]] describing why C is more effective than C++ and in general most of OOP languages. The article is well written and for a while I was nodding in an agreement. The claim that by using OOP and insisting on encapsulation one cannot implement linked list as effectively as in C is a very good one!
+
There is a difference between [[MarketingVersion]] and engineering approach to versioning. Hear why: [[MarketingVersion|read more]]...
-
However later I realized that the take on OOP is really targeted to OOP languages of the past. In modern languages, like [[Scala]], one can keep encapsulation and still be as effective as the old plain good C.
+
--[[User:JaroslavTulach|JaroslavTulach]] 05:26, 11 June 2023 (UTC)
-
All you need is proper orchestration between the ''List'' container and its [[trait|element]]s. [[Scala]] will then type-safely handle the rest for you!
+
==== Do not Expose Deep Hierarchies! ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 05:11, 3 September 2012 (UTC)
+
Do not expose [[DeepHierarchy]] of classes when designing an API!
-
==== Why I Became an API Designer? ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 05:39, 24 September 2022 (UTC)
-
{{:API Designer}}
+
==== Using '''record''' on any [[JDK]]! ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:17, 30 August 2012 (UTC)
+
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.
-
==== Is Invisible Method Signature Part of API? ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 07:10, 23 April 2022 (UTC)
-
{{:InvisibleAbstractMethod}}
+
==== 2021: Code [[VSCode]] [[UI]] in [[Java]] ====
-
--[[User:Apidesign|Apidesign]] 12:13, 20 March 2012 (UTC)
+
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!
-
==== API Design is JavaOne Rock Star ====
+
[[Image:Vscodehtmlui.png]]
-
My presentation about [[ParadoxesVideo|API Design Paradoxes]] has been rewarded as one of the more interesting ones during [[JavaOne2011]]. There is no video at the [http://www.oracle.com/javaone/quick-links/rock-star/2011-rock-stars-1453436.html JavaOne rock star page], but as I keep repeating the presentation again and again with almost the same content, you can view the [[ParadoxesVideo|Linz 2009]] version or [[Ostrava|Ostrava's 2011]] translation to Czech.
+
Since December 10, 2021 it is real: one can code [[HTML]] [[UI]] in [[Java]] and display it in [[VSCode]] as well as [[NetBeans]]. See [https://github.com/apache/netbeans/pull/3349 PR-3349].
-
It was fun to talk about [[Paradoxes]], but I guess it is time to come up with something new. I'll try to resubmit my talk about [[AnnotationProcessor]]s next year. Hopefully the just gained Rock Star status will give that talk few plus points and raise its chances to be accepted.
+
--[[User:JaroslavTulach|JaroslavTulach]] 07:43, 10 December 2021 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:58, 20 January 2012 (UTC)
+
==== [[Bck2Brwsr]] 0.50: Ready for 2021 Technologies ====
-
==== Beware of Friends! They'll Change You! ====
+
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 [[Bck2Brwsr 0.50|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.
-
In case you are doing something for [[FriendDependencies|friends only]] (as many of ''facebookers'' do), you are in a great danger. Blindly increasing list of your [[FriendDependencies|friends]] is not for free. Because (as soon as you change list of your [[FriendDependencies|friends]]) you change yourself, you will immediatelly become ''different'' from outside.
+
Read more at [[Bck2Brwsr 0.50]] release page...
-
This, in an [[API]] terminology means, you need to produce new version of '''yourself'''. Thus, when you publicaly state you have a new [[FriendDependencies|friends]], version yourself! Read about [[FriendDependencies]] to understand why!
+
--[[User:JaroslavTulach|JaroslavTulach]] 19:48, 1 August 2021 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 15:20, 19 September 2011 (UTC)
+
==== Run on JDK8, use JDK11 APIs! ====
-
==== [[JDK]]7 Breaks [[JUnit]] Tests ====
+
Do you want to [[AlternativeImplementation|run your application on JDK8]], but use JDK11 APIs? That's traditionally done with a reflection. But there is a [[AlternativeImplementation|better way]]!
-
Without the intent to blame JDK7 for being finally available, I have a [[OrderOfElements|concern]] to [[OrderOfElements|share]]. After switching the NetBeans test runs to use JDK7, most of the test suites [[OrderOfElements|started to fail]] randomly!
+
--[[User:JaroslavTulach|JaroslavTulach]] 06:17, 16 February 2021 (UTC)
-
In case you are considering to switch to JDK7 and you have existing JUnit tests, consider including the time for [[OrderOfElements|stabilization of the tests]] into your migration plan.
+
==== [[Helidon]] MP 2.0 supports [[GraalVM]] [[NativeImage]] ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 12:33, 22 August 2011 (UTC)
+
[[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]].
-
==== [[API]] Designers: Are You Planting Forests or Gardens? ====
+
[[Helidon]] 2.0 [https://medium.com/helidon/announcing-helidon-2-0-19c245f5488a was released] on June 24, 2020. It's [[MicroProfile]] edition (including compatible [[CDI]] implementation) works with [[NativeImage]].
-
Today I have an unusual chance to talk about gardening (or planting forests) when designing APIs. The key concept to grasp is the ability to [[APIvsSPI|mount]] various types of APIs together. Btw. do you know that there are more [[APIvsSPI|types of APIs]], right? Learning how to [[APIvsSPI|mount]] them together is an important knowledge that will determine whether your [[APIvsSPI|API or SPI]] will turn into a beautiful garden or fall into disorder of unmaintained, dark forest. Visit [[APIvsSPI|today's essay]] to learn how to properly [[APIvsSPI|mount]] [[APIvsSPI|client APIs and provider APIs]] so they can strengthen [[APIvsSPI|each other]].
+
--[[User:JaroslavTulach|JaroslavTulach]] 19:17, 29 June 2020 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 13:03, 21 March 2011 (UTC)
+
==== Available on Safari Books Online ====
-
==== Using [[Netbinox]] [[NetbinoxHook|hooks]] ====
+
{{:SafariOnline}}
-
Do you want to use extension [[NetbinoxHook|hooks]] to extend behavior of Netbinox the same way you used to extend Equinox? Before version 1.16.7 this used to be complicated, but as this [[NetbinoxHook|little tutorial]] shows, now [[NetbinoxHook|hooks]] can be registered easier than ever.
+
--[[User:JaroslavTulach|JaroslavTulach]] 05:50, 25 May 2019 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 15:49, 29 January 2011 (UTC)
+
==== [[TenYears]] of the [[TheAPIBook|Practical API Design]] book ====
-
==== Beware of Using [[Enum]]s ====
+
{{:TenYears}}
-
Have you ever thought that [[enum]] in JDK5 is good idea? Then welcome to the club. I used to think that as well. But it is not, when it comes to API design. Read [[enum|why]] to understand its gotchas.
+
--[[User:JaroslavTulach|JaroslavTulach]] 06:36, 29 July 2018 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 22:04, 12 January 2011 (UTC)
+
==== Bck2Brwsr 0.23: Get Started via [[Gradle]]! ====
-
==== Visualize [[Lookup]] ====
+
{{:Bck2Brwsr 0.23}}
-
There is a [http://dev.imagejdev.org/gbh/lookup/map.htm very nice visualization] of [[Lookup]] and its family on the [http://dev.imagejdev.org/gbh/lookup/map.htm ImageJ web site]. It is created by MindMap and I find it quite explanatory. In case you ever wanted to sort your thoughts about [[Lookup]], this [http://dev.imagejdev.org/gbh/lookup/map.htm mind map]] is definitelly going to help.
+
--[[User:JaroslavTulach|JaroslavTulach]] 04:02, 1 June 2018 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 16:24, 10 January 2011 (UTC)
+
==== [[Singletonizer]] [[API]] Design Pattern ====
-
==== Access [[Facebook]] from a Desktop Application ====
 
-
Having trouble to access [[Facebook]] from your desktop application? I know how to help you out of your missery. Read [[facebook|the story]] and source code for my [[Facebook|Feedbook]] desktop application - application that I use to re-publish my blogs from this site to my [[Facebook]] account.
+
Recently I have successfully used the [[singletonizer]] API design pattern in [[Graal]]'s '''Graph I/O''' [[API]] [http://www.graalvm.org/graphio/javadoc/org/graalvm/graphio/package-summary.html javadoc]. The result ain't that bad, right?
-
--[[User:JaroslavTulach|JaroslavTulach]] 19:46, 16 November 2010 (UTC)
+
--[[User:JaroslavTulach|JaroslavTulach]] 06:51, 25 January 2018 (UTC)
 +
==== Is [[Spring]] the Sole Reason why [[Java]] is Becoming the new [[COBOL]]? ====
-
==== One [[ClassLoader]] to Know Them All! ====
+
Is there anything good on [[Spring]] that wouldn't be seen ridiculous by non-enterprise-Java users?
-
Modularizing monolithic application into individual pieces has various benefits. For example classes will be well isolated from each other. However there can also be pitfalls. For example classes can be too much isolated from each other and '''Class.forName''' can yield bunch of '''ClassNotFoundException'''s. What you need in such situation is a [[ThreadContextClassLoader|classloader that knows everything]]. Here is a little [[ThreadContextClassLoader|essay]] about problems you can face when building [[ThreadContextClassLoader|it]].
+
--[[User:JaroslavTulach|JaroslavTulach]] 11:46, 18 December 2017 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 10:35, 9 November 2010 (UTC)
+
==== [[Bck2Brwsr]] 0.20 - the Radtouren 2017 Release ====
-
==== Removing '''protected''' '''abstract''' Methods is no Longer Source Compatible ====
+
{{:Bck2Brwsr_0.20}}
-
Rijk van Haaften [[Errata 6|noticed today]] that removing '''protected''' '''abstract''' methods (which used to be ''source compatible'') is no longer compatible at all. I am adding his comment to [[Errata 6|errata for chapter 6]]. Please find Rijk's observation [[Errata 6|there]].
+
--[[User:JaroslavTulach|JaroslavTulach]] 13:27, 9 July 2017 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 07:44, 8 October 2010 (UTC)
+
==== Codesnippet Doclet 0.20 Release ====
-
==== [[JDK]]6 [[API]] for [[SQL]] Syntax Completion ====
+
Enhance your Javadoc with [[Codesnippet4Javadoc]] version 0.20 which now supports special "coloring" for strings and comments.
-
Do you know that [[LiveDB#Extending_IDEs|there is]] a standard Java API for extending any IDE with code completion? That you can easily, without writing any IDE plugin show list of SQL tables inside strings? Learn [[LiveDB#Extending_IDEs|more]], try out whether your favorite Java IDE comes with real [[LiveDB#Extending_IDEs|support for Annotation Processors]]. If not, make a switch to the best IDE that [[LiveDB#Extending_IDEs|does that]]!
+
--[[User:JaroslavTulach|JaroslavTulach]] 10:40, 16 February 2017 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 18:56, 29 August 2010 (UTC)
+
==== Beware of [[DefaultMethods]] ====
-
==== [[LiveDB]]: Make Your Database Schema Part of Your Sources ====
+
[[DefaultMethods]] is a new feature of JDK8 that we many cried for. Yet, they carry certain drawbacks with themselves. For example one can write [[DefaultMethods|a valid Java program]] that compiles and works on [[JDK]]7, but is broken on [[JDK]]8!
-
I really hate when something is defined at two places. Things like that may easily get out of sync and where is the truth then? I am glad that my little [[LiveDB]] experiment shows one more field in [[Java]] where such duplication may no longer be necessary: with [[LiveDB]] you can access schema of your database ''live''. ''Live'' not only during compilation, but also during developement from inside of any good IDE.
+
--[[User:JaroslavTulach|JaroslavTulach]] 10:42, 24 September 2016 (UTC)
-
Get the [[LiveDB]] sources to learn more. Watch our [[LiveDB]] screen cast. [[LiveDB|Share]] your thoughts!
+
==== Test your [[API]]s Easily with [[Maven]] [[SigTest]] Plugin ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 17:17, 30 July 2010 (UTC)
+
The ''NetBeans API & Maven community'' (e.g. me and Miloš Kleint) is proud to announce the immediate availability of [[netbeans:SigTest|sigtest-maven-plugin]]. [[SignatureTests|Signature testing]] has never been easier: just follow the tips on the [[netbeans:SigTest|SigTest]] main page and you'll never make an incompatible change since then!
-
==== [[Equinox]] Compatibility Shaking ====
+
Read [[TheAPIBook]] and let NetBeans [[netbeans:SigTest|SigTest]] [[Maven]] plugin look over you and make you great [[API]] designer! Enjoy!
-
While trying to upgrade from version 3.5 to 3.5.2 I noticed some [[EquinoxCompatibility]] problems. Why can't an [[upgradability|upgrade]] of a minor version of some library be just a plain drop in replacement? How can someone rely on a library which shakes its behavior like an [[amoeba]]?
+
--[[User:JaroslavTulach|JaroslavTulach]] 17:52, 15 July 2016 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 09:34, 13 July 2010 (UTC)
+
==== Boost Your Career: Become an API Tester! ====
-
==== [[Equinox]] is not Ready for Modular Environment! ====
+
{{:APIUsabilityStudy}}
-
Today I noticed one [[BootstrappingEquinox|bootstrapping problem]] with [[Equinox]] which makes it completely unusable for execution in [[modular system]]s. Rather than fixing it I decided to write (thought) provoking [[BootstrappingEquinox|blog]] about problems [[BootstrappingEquinox]]. I hope it will help everyone understand how [[BootstrappingEquinox|bad the situation]] is and encourage creation of [[BootstrappingEquinox|proper fix]].
+
--[[User:JaroslavTulach|JaroslavTulach]] 08:13, 6 June 2016 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:20, 7 May 2010 (UTC)
 
-
==== Unbearable Painfulness of Being [[Stateful]] ====
+
==== Improve [[Javadoc]] of Your [[API]]: Stop showing crappy code samples! ====
-
Do you know the feeling like [[stateful|this]]? Something leaves strong impression inside you. So strong that you want to speak up. Later you calm down. Then you get into similar situation again. This time you want to scream. Then you forget. At least you try. But the nightmare comes back again, and now you can't remain silent.
+
I've just finished integration of [https://github.com/jtulach/codesnippet4javadoc 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!
-
This happens to me particularly when using [[stateful|one specific]] NetBeans API. For a while I was just complaining to myself, but then I realized the cause of the problem. The API was properly reviewed (even by me) and looked OK, but as time shows, there is a hidden catch: It is too [[stateful]]! It is easy to write program that compiles against that API. It is much more harder to create a program that also executes without throwing runtime exceptions.
+
If you care about [[Javadoc]] of your [[API]], consider using '''Codesnippet''' doclet too!
-
Have you ever had similar experience? Has it been also because of the API being too [[stateful]]? Compare your experience with [[stateful|mine]].
+
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]].
-
--[[User:JaroslavTulach|JaroslavTulach]] 14:29, 2 May 2010 (UTC)
+
Do your [[API]] a favor: use [https://github.com/jtulach/codesnippet4javadoc Codesnippet Javadoc Doclet] and make your code samples real!
-
==== The Fastest [[OSGi]] Container ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 15:59, 30 December 2015 (UTC)
-
Are you seeking for the world's [[NetbinoxPerformance|fastest OSGi container]]? Then you are on the right blog - since yesterday the OSGi container with fastest start is [[NetbinoxPerformance|provided by NetBeans]]!
+
==== [[Java]] Modularity in the Context of [[JavaScript]] ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 12:15, 2 April 2010 (UTC)
+
[[ObfuscatePerLibrary|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]]?
-
==== Introduce Yourself to Your Mirror! ====
+
Yes, it should. And it has been done! Here is description of design and implementation of [[ObfuscatePerLibrary|Obfuscation per JAR file]] for [[Java]] (in a [[Bck2Brwsr|browser).
-
Are you [[protocols|talking]] to yourself when standing in front of a mirror? Are you properly [[protocols|introducing]] yourself to your mirror picture? No!? Well, you should be. Good communication [[protocols]] require people to introduce before the real chat starts.
+
--[[User:JaroslavTulach|JaroslavTulach]] 04:10, 29 May 2015 (UTC)
-
To improve your design skills, I suggest you to do it even dealing with a [[protocols|man in the mirror]]!
+
==== [[ConfigurationObject]] Pattern in Java ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 03:38, 25 March 2010 (UTC)
+
[[ConfigurationObject]] pattern is quite common in many [[JavaScript]] libraries. Do you know what is the best way to express it in [[Java]]? Check [[ConfigurationObject|my essay]] that compares four different ways and analyses their impact on [[API]] designer and especially [[API]] users.
-
==== Reach harmony. Play Single-tone! ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 12:44, 22 February 2015 (UTC)
-
A step by step cook book for properly using [[Injectable Singleton]]s is now available. In case you ever wanted to expose your ''application state'', the [[Injectable Singleton]]s approach gives you sound, simple, testable and extensible way to do it. I don't expect a massive migration from DI to [[Injectable Singleton]]s, but in some situations this pattern may be handy. If you find [[Injectable Singleton]]s useful, [[Talk:Injectable Singleton|share your experience]] with others.
+
==== [[Final interface]]. Finally Done Right! ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 20:12, 9 February 2010 (UTC)
+
Maybe there is nobody interested in [[final interface]] [[:Category:APIDesignPatterns|API Design Pattern]] anymore! Now when there is [[JDK]]8 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 [[:Category:APIDesignPatterns|API Design Patterns]] Collection.
-
+
-
==== Overcome Your Fear of Being Single(ton)! ====
+
Let's me guide you through the short and incomplete history of [[final interface]] design pattern with small excursion to [[final interface|JDK's own itches]] and specifics of [[final interface|designing for OSGi]] to finally describe how to do [[final interface]] pattern right!
-
Have you ever felt lonely like a [[singleton]]? I do from time to time. Especially when I get a feeling that I cannot break through and outreach people who I'd like to talk to.
+
Let you find [[final interface|such description]] useful!
-
Surprisingly this often happens when trying to talk to DI community. I cannot enumerate how many times I heard: "This is not DI!" "[[Singleton]]s are wrong!" "Learn to use Spring and then come back!" Looks like I have a problem with DI guys. But that is not true, I like DI, I've (already) learned a lot about it! It is more that some DI proponents seem to have problem with us. It usually go like this: A Joe Developer after being hurt few times by coding without DI, learns about DI, finds it amusing, uses it successfully, things start to make sense. Then, rather then being happy that Joe's own projects are fine, Joe starts to evangelize the right way to code. What is not DI is wrong or at least old fashioned, and deserves a rewrite. It actually does not matter what it is, but if it is not using DI, it has to be bad.
+
--[[User:JaroslavTulach|JaroslavTulach]] 16:53, 4 February 2015 (UTC)
-
The problem is that Joe never investigates what the other technology is, never tries to understand whether it is wrong or not. Joe has pre-made answers for everything. Joe's opinion is straighten inside of own community. The fact that the community is rapidly growing ensures Joe that this is the only way to deal with programming. Everyone else needs to convert, or be crucified. The faster, the better. Don't waste time trying to understand the others!
+
==== [[Impossible]]. Part II. ====
-
As a result not many DI fans outreach and give us a chance to speak up. Thus I am very glad that Witold Szczerba did it, and asked very interesting question with a lot of good reference material. As a result I could sort out my own thoughts and create a defense of [[singleton]]s.
+
Everybody understands [[ImpossibleThreading|threading]] is complex. Yet almost everyone believes that with good methodology it is possible to do [[ImpossibleThreading|threading]] right. Well, it is not. There is no theory to eliminate [[deadlock]]s. Achieving [[ImpossibleThreading|proper threading is impossible]]. Still people keep asking for it. When you tell them [[ImpossibleThreading|it is impossible]], you may get fired. Just like me few years ago! Here is my [[ImpossibleThreading|story]].
-
Don't be afraid of [[singleton]]s! They are quite friendly if you know [[singleton|how to use them]]!
+
--[[User:JaroslavTulach|JaroslavTulach]] 19:23, 3 January 2015 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:26, 25 January 2010 (UTC)
+
-
==== Tim Boudreau on Lookup ====
+
==== Publish [[Bck2Brwsr]] Libraries as [[Maven]] Artifacts ====
-
In response to a mailing list question Tim decided to explain [[Lookup#Tim_Boudreau_on_Lookup|everything you ever wanted to know about Lookup but were afraid to ask]].
+
[[Bck2BrwsrLibraries]] can now be published as [[Maven]] Artifacts which greatly reduces edit/compile/run time.
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:59, 20 January 2010 (UTC)
+
--[[User:JaroslavTulach|JaroslavTulach]] 05:21, 7 December 2014 (UTC)
-
==== Video: Paradoxes of API Design ====
+
==== [[Bck2Brwsr]] and Images as Resources ====
-
Do you want to [[Paradoxes of API Design|learn something]] about [[API]] design while watching TV? Then you need to get my show from [[Paradoxes of API Design|Blip TV]]!
+
[[Bck2BrwsrBlobURLs|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 [[Bck2BrwsrBlobURLs|browser valid URL]].
-
--[[User:JaroslavTulach|JaroslavTulach]] 11:28, 12 January 2010 (UTC)
+
--[[User:JaroslavTulach|JaroslavTulach]] 01:19, 30 October 2014 (UTC)
-
==== The Little Manual of API Design ====
+
==== [[Impossible]]. Part I. ====
-
When googling around for new references to my book I found out a [[The Little Manual of API Design|year old PDF]] from Trolltech. {{:The Little Manual of API Design}}.
+
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''!
-
--[[User:JaroslavTulach|JaroslavTulach]] 13:50, 28 November 2009 (UTC)
+
--[[User:JaroslavTulach|JaroslavTulach]] 14:25, 20 October 2014 (UTC)
-
==== Avoid [[Visitor]]s. Unless you really know them. ====
+
==== Lambdas Go [[Bck2Brwsr]]! ====
-
[[Visitor]] pattern is one of the well known [[OOP]] patterns. However using it in an [[API]] is dangerous. At least unless you have read [[chapter 18]] of [[TheAPIBook]] or studied my [[visitor|sample code]].
+
[[Bck2Brwsr 0.10]] has just been released. The most important thing to note is that it handles JDK8's [[Closures|lambdas]]. See the illustrative video:
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:59, 24 November 2009 (UTC)
+
{{#ev:youtube|ATp7WgUCIbU}}
-
==== Podcast: [[AOP]] is not dead. If you know how to use it! ====
+
The [[JDK]] emulation library is still based on [[JDK]]7, so don't expect your streams & co. code to run. I'll update to [[JDK]]8 after [[JavaOne2014]]. Meanwhile enjoy [[Closures|lambdas]] in your own [[API]]s!
-
Recently I saw the future of [[AOP]]. I thought one should say goodbye to AspectJ and its clones and get ready for ease of use that makes [[AOP]] wide spread! After few [[Talk:AOP|comments]] I know that it is enough to learn more advanced capabilities of AspectJ. But don't forget to do so, such flavor of [[AOP]] is much better than plain writing of aspects.
+
--[[User:JaroslavTulach|JaroslavTulach]] 17:48, 15 September 2014 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 12:56, 21 November 2009 (UTC)
+
==== Use [[NetBeans]] to Deploy Everywhere! ====
-
==== Screencast: Module System for [[Java]] ====
+
{{:DukeScriptInNetBeans}}
-
[[Module system]] is single, most important missing feature of [[Java]]. It is essential for the vitality of the [[Java]] system to define and agree on shared standard. On shared common ground. Recently me and [[Geertjan]] created a recording where we discuss why it is important to have it. We also demonstrate on the [[NetbinoxTutorial|NetBeans and Mylyn]] synergy how such system would simplify our lives. If you have half an hour, listen to [[Module system|our screencast]] and join us with comments.
+
--[[User:JaroslavTulach|JaroslavTulach]] 11:09, 18 June 2014 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 09:07, 27 October 2009 (UTC)
+
==== [[MineSweeper]] on [[iOS]] ====
-
==== The End of [[MVC]] as We Know it ====
+
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?
-
Geertjan literally forced me to record a screencast about [[DCI]] with [[Geertjan|him]] today. We did rehearsal over lunch and beer (quite lively and interactive). Then he drag me into the recording room and we did it (less interactive, but more serious and important).
+
[[Image:MineSweeper-iOS.png]]
-
[[DCI|Join us]] to learn why [[MVC]] days are over and you should switch to a new [[DCI|paradigm ready for the 21st century]]!
+
--[[User:JaroslavTulach|JaroslavTulach]] 14:13, 21 May 2014 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 20:52, 22 September 2009 (UTC)
+
==== [[TeaVM]] Can Execute [[DukeScript]] Applications! ====
-
==== @Synchronized ====
+
Alexey just released his first version of [[TeaVM]]. Congratulation!
-
{{:Synchronized}}
+
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 [http://xelfi.cz/minesweeper/teavm/ minesweeper 1] and [http://xelfi.cz/minesweeper/bck2brwsr/ minesweeper 2].
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:51, 7 September 2009 (UTC)
+
Enjoy and give [[DukeScript]] (the JavaScript, the way it was meant to be) a try!
-
==== XML, Schema, SAX. @Annotations! ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 14:27, 20 March 2014 (UTC)
-
Some [[Talk:First_Amoeba_Video|say]] that code completion with annotations is not big improvement. XML can have code completion too if we give XML Schema with it. I [[Talk:First_Amoeba_Video|disagree]]! Anyone to comment on [[Talk:First_Amoeba_Video|that]]?
+
==== Avoid Synchronization Problems ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 10:35, 31 August 2009 (UTC)
+
Don't let your objects escape from your methods! As suggested on [[Errata 11|page 193]].
-
==== Extend Inextensible! ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 16:24, 14 February 2014 (UTC)
-
Interfaces are not extensible. [[ExtendingInterfaces|Learn]] how to extend them!
+
==== Changes: HTML for Java, [[:Category:Video|video]]s and hosting ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 11:31, 19 August 2009 (UTC)
+
I'd like to announce few changes related to apidesign.org site.
-
==== Try to Steal my Object! ====
+
First of all, the [[Knockout4Java]] is now a [[HTML4Java|NetBeans subproject]] and yesterday I managed to release its first bits as a stable version 0.7 - follow [[Knockout4Java|three simple steps]] to see how powerful [[Java]]/[[HTML]] user interface can be.
-
Recently my cousin was teasing my mind with a question whether there is a way to make anything [[PrivateJavascript|private in Javascript]]. I may be wrong, but I think there is: Is there anyone who can [[PrivateJavascript|steal and modify]] my internal ''impl'' object?
+
The other change is that I am migrating the whole website to new hosting infrastructure. [[Sources]] are up, [[Main Page|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.
-
--[[User:JaroslavTulach|JaroslavTulach]] 04:35, 5 August 2009 (UTC)
+
One thing you don't have to complain is lack of [[:Category:Video|video]]s - 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?
-
==== Plug into Your Compiler! Optimize Your Framework by Generating Compile Time Caches. ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 08:24, 14 January 2014 (UTC)
-
Learn how to generate [[CompileTimeCache]]s with a little help of source-only [[annotation]]s and their [[AnnotationProcessor]]s.
+
==== Can De[[serialization]] Change Value of a Final Field? ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 14:08, 25 July 2009 (UTC)
+
De[[serialization]] can change value of a '''final''' field. See the [[serialization|code snippet]] to understand how. 1st lesson learned at [[JavaOne2013]].
-
==== Victims of Conceptual Surface ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 16:58, 23 September 2013 (UTC)
-
Do you know how to eliminate classes with too many dependencies like '''java.beans.Beans'''? You need to [[Modular_Java_SE#Sneaking_Simplicity_In|Sneak in Simplicity]]!
+
==== The Art of Writing [[Equals]] in [[OOP|Object Oriented Languages]] ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 16:32, 22 June 2009 (UTC)
+
Do you think you know how to write [[equals]]? Are you sure? Take your time. Still sure? Check [[equals|this example]] to verify.
-
==== Splitting applet and beans via [[CodeInjection]] ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 08:53, 6 September 2013 (UTC)
-
I have a [[Modular_Java_SE#Infrastructure|basic infrastructure]] to split the JDK which could be useful in your project as well. Also I managed to successfully [[Modular_Java_SE#java.applet_and_java.beans|split java.beans and java.applet]] packages.
+
==== [[Bck2Brwsr]] Goes Server Side: Run the Same Code on Server and Client! ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 12:39, 17 June 2009 (UTC)
+
I'd like to introduce my [[JSON4Jersey|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.
-
==== Help me modularize JDK ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 12:45, 20 May 2013 (UTC)
-
Creating [[Modular_Java_SE|modular JDK]] while keeping compatibility with the existing monolithic one may be tricky. Will you help me find right way to do it?
+
==== Introducing [[Knockout4Java]] ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 20:14, 14 June 2009 (UTC)
+
[[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]]!
-
==== Everyone is equal. Except [[Privileged API|Power]] Users. ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 21:32, 16 May 2013 (UTC)
-
Learn to design [[Privileged API]] suitable for ''power'' users of your library. Don't forget to listen to [[Media:Apitip03-constructor-and-competition.mp3|podcast #3]].
+
==== Introducing [[FXBrwsr]] ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 17:01, 25 May 2009 (UTC)
+
[[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]].
-
==== Double Injection. Loosely Coupled SpringFramework. ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 09:25, 30 April 2013 (UTC)
-
I have just finished the [[LookupAndSpring|bridge]] between [[Spring]] and [[Lookup]] (originally written by [[AndreiBadea]]) and prepared a [[LookupAndSpring|demo application]] to demonstrate what it can be [[injection|useful for]].
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 04:43, 28 April 2009 (UTC)
+
==== [[Javadoc]] for Coding for Your Browser Published! ====
-
==== Clear Definition of Version ====
+
I've just set a job up to generate [[Bck2BrwsrJavadoc]]. Anyone wants to design a library for the browser?
-
Interfaces are absolutely perfect tool to achieve [[ClearDefinitionOfVersion]]. A curious reader [[Talk:ImplementOnlyInterface‎|question]] made me write the [[ClearDefinitionOfVersion]] page - many thanks for your [[Talk:ImplementOnlyInterface‎|talkback]].
+
--[[User:JaroslavTulach|JaroslavTulach]] 09:11, 1 March 2013 (UTC)
-
--[[User:JaroslavTulach|JaroslavTulach]] 19:55, 24 April 2009 (UTC)
+
==== [[C++]] May Not Be As Bad As Thought! ====
 +
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 [[trait|recent post]] I managed to prove that by using [[trait]]s, 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?
-
==== Lookup is Free! ====
+
I am glad to report we have an [[C++|answer]] with a [[C++|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.
-
Time to pickup [[Lookup|cherries]]! Nobody can know what happens to [[NetBeans]] after the [[wikipedia::Sun_Microsystems|Sun]]/[[wikipedia::Oracle_Corporation|Oracle]] acquisition. Better to be ready for everything and save the [[NetBeans]] [[API]] pieces that make sense outside of the project boundaries. One of them is [[Lookup]]. I am proud to announce that [[Lookup]] has new home now: [http://lookup.apidesign.org lookup.apidesign.org]. Welcome the refugee and let me know if there is a way I could improve the library.
+
Last note related to this incident (influenced by [[Thinking, Fast and Slow|book]] I am currently reading). There are tons of comments attached to the original [http://www.250bpm.com/blog:8 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 [[Thinking, Fast and Slow|fast thinking]].
-
--[[User:JaroslavTulach|JaroslavTulach]] 05:54, 21 April 2009 (UTC)
+
It took me a weekend to come up with the [[trait]] solution and we needed about a week to polish the [[C++|C++ sample code]]. Looks like a little bit of [[Thinking, Fast and Slow|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.
-
==== D2D: Factory instances are more flexible than factory classes ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 07:40, 27 September 2012 (UTC)
-
As part of ''Designers To Designers'' section on this website I seem to have a unique chance to introduce [[Talk:Factory|Factory instances are more flexible than factory classes]] article by (yet) unknown designer. Enjoy, [[Talk:Factory|talk back]].
+
==== Older Blog Posts ====
-
--[[User:JaroslavTulach|JaroslavTulach]] 08:40, 18 April 2009 (UTC)
+
[[OlderBlogPosts]]...
-
==== Can there Be ''Implement Only'' Interface? ====
+
--[[User:JaroslavTulach|JaroslavTulach]] 07:00, 27 September 2012 (UTC)
-
Here is my [[ImplementOnlyInterface|answer]] to question that I [[Talk:ClarityOfTypes|got by parren]].
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 18:20, 12 April 2009 (UTC)
 
-
 
-
==== Application Context in [[Ruby]] ====
 
-
 
-
Recently I've noticed a lot of [[Talk:Blogs:JaroslavTulach:Theory:LanguagesForEvolution#Ruby_Application_Context|activity]] in the [[Main_Page|apidesign.org wiki]]. Perfect. Inspite it is more posts than I can handle.
 
-
 
-
However I am thankful for all your comments and I hope this [[Main_Page|wiki]] can become a place for exchange of ideas between people interested in [[API]] design. For example, Steve Shapero added a note about his will to seek for [[Talk:Blogs:JaroslavTulach:Theory:LanguagesForEvolution#Ruby_Application_Context|Application Context]] implementation in [[Ruby]]. I personally cannot be really useful, as my knowledge of the [[Ruby]] language is quite basic, but maybe some of you will join Steve's effort.
 
-
 
-
PS: Let us know how it went. You know, I feel that [[Ruby]]'s duck-typing and [[API]] contracts may not be ''mutually strengthening''...
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 19:30, 11 April 2009 (UTC)
 
-
 
-
==== Get Rid of Multi-Meaning Classes ====
 
-
 
-
In the latest [[ClarityOfTypes|example related to modifiers]], I'll explain how to achieve even more [[clarity]] than advocated by [[EliminateFuzzyModifiers]] essay. Today we are going to [[ClarityOfTypes|eliminate multi-meaning classes]]!
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 16:42, 1 April 2009 (UTC)
 
-
 
-
==== Eliminate Fuzzy Modifiers! ====
 
-
 
-
Time for [[EliminateFuzzyModifiers|new post]] about modifiers. My recent take on [[ClarityOfAccessModifiers|access modifiers]] generated quite a bit of interest. I've received a [[Talk:ClarityOfAccessModifiers|bunch of comments]] and I am thankful for all of them! I've learned about approaches taken by different languages, I've started to think about my future, but more importantly ''Arno Nyhm'' asked me to:
 
-
 
-
: please show not only a bad example for the Factorial
 
-
: but also a good solution for this implementation.
 
-
 
-
At your wish ''Arno''! Enjoy (almost) real world example how to [[EliminateFuzzyModifiers]]! And let me know what [[Talk:EliminateFuzzyModifiers|you think]].
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 20:50, 27 March 2009 (UTC)
 
-
 
-
==== Time to Fix [[Java]] Access Modifiers! ====
 
-
 
-
I have an [[Blogs:JaroslavTulach:Practical Design:FixModifiers|open letter]] to designers of [[Java]] language for [http://openjdk.dev.java.net JDK7]: Can you please make [[Java]] modifiers [[API]]-friendly?
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 22:14, 25 March 2009 (UTC)
 
-
 
-
==== Co-exist in Peace! Accept Alter Ego. ====
 
-
 
-
APIs age and from time to time they get into so bad state that they need an [[AlternativeBehaviour|alternative]] reimplementation. At that time one has to face a dilemma: Keep [[BackwardCompatibility]] or break it and improve the [[API]]? As [[AlternativeBehaviour]] page explains there is no contradiction between these two. One can deliver improvements while retaining [[BackwardCompatibility]]. All that is needed to teach the [[API]] to accept its Alter Ego.
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 16:56, 16 February 2009 (UTC)
 
-
 
-
==== Beware Exposing Yourself to Public! ====
 
-
 
-
Erwin Vervaet asked me to provide an explanatory example:
 
-
:I have a question regarding chapter 11, section "Pitfalls of Java Monitors".
 
-
:Could you please provide an example illustrating the problem, where
 
-
:subclasses interfere with the parent class's monitors?
 
-
It took me a while to expose that example, but here finally is my newest page talking about Pitfalls of [[Java Monitor]]s.
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 10:15, 12 February 2009 (UTC)
 
-
 
-
==== Try, catch, and don't give up! ====
 
-
 
-
When your call to a method generates an exception, what can you do? Print warning and give up? Yes, often. Unless the [[TryCatchRedo]] pattern is in use!
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 15:29, 2 February 2009 (UTC)
 
-
 
-
==== Accept Unacceptable! ====
 
-
 
-
When you maintain some code and you get a patch that you do not like, what can you do? Is the only option to refuse the change, or is there a better way? Of course, as this was just a rhetorical question, there is better solution: Just create a [[CodeInjection|code slot]]!
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 21:31, 10 January 2009 (UTC)
 
-
 
-
==== Singletonize your own Factories! ====
 
-
 
-
I am reading my own book and I've just got to page that talks about a pattern called among the NetBeans team [[Singletonizer]]. [[TheAPIBook]] describes it with a small note, but as I think it is very useful, I've just created a dedicated [[Singletonizer|page]] describing it in more detail, giving it more, well deserved, publicity.
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 16:29, 25 December 2008 (UTC)
 
-
 
-
==== Wizard is the best [[API]] ====
 
-
 
-
There is a nice [[Talk:PropertyFiles|discussion]] provoked by description of my [[PropertyFiles|manifest advantures]]. It reminds me once again how important tools are. As I wrote somewhere in [[TheAPIBook]], I guess it is in [[Keep_Testability_In_Mind|Chapter 9]], one of the best [[API]]s is '''wizard'''. Good wizard can turn any API, regardless how bad, into perfectly shining, beautiful [[Blogs:JaroslavTulach:Theory:DiamondsVsStars|star]]. Good tools make everything easier.
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 13:49, 19 December 2008 (UTC)
 
-
 
-
==== Builder vs. Cumulative Factory ====
 
-
 
-
Is [[Builder]] better [[APIDesignPatterns|pattern]] than [[CumulativeFactory]]? As Radim and Paulo [[Talk:CumulativeFactory|pointed out]], it might be. However from [[Builder|my point of view]], it is an extension to [[CumulativeFactory|the previous one]]! Read more and [[Builder|help us decide]]...
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 13:02, 15 November 2008 (UTC)
 
-
 
-
==== Cumulative Factory [[APIDesignPatterns|API Design Pattern]] ====
 
-
 
-
Dear API writers, let me introduce you to [[APIDesignPatterns:CumulativeFactory|cumulative factory]] [[APIDesignPatterns|API Design Pattern]]. Read [[APIDesignPatterns:CumulativeFactory|more]]...
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 15:38, 9 November 2008 (UTC)
 
-
 
-
==== ''How Many People Have to Die'' leakages ====
 
-
 
-
Recently I've been [[LeakingCulturalContext|warned]] that my sidebar in [[Ever_Changing_Targets|Chapter 4]], Ever Changing Targets talks about events that are completely ununderstandable for international readers. That made me write a short essay about [[LeakingCulturalContext|leakages of cultural contexts]] and the similarities with the [[TheAPIBook|API Design]].
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 05:01, 21 October 2008 (UTC)
 
-
 
-
==== Exceptions in API ====
 
-
 
-
 
-
Casper Bang asked following question about [[APIDesignPatterns:Exceptions|exceptions in API]] after reading the [[TheAPIBook]]:
 
-
 
-
''I was curious as to know how come, in a book strictly about API design in Java, you do not mention exceptions (particular checked exceptions) and the role they play in documenting assertions vs. hampering versionability. Did you simply think this to be too controversial an issue I wonder?''
 
-
 
-
Good question! Inspiring. Here are my current answers: [[APIDesignPatterns:Exceptions|exceptions in API]].
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 21:37, 14 September 2008 (UTC)
 
-
 
-
 
-
==== Have You Ever Wondered? ====
 
-
 
-
Many people want to know, before they start to read a book, whether it can help them solve some problems they have faced. That is very likely reason why many books start with ''have you ever wondered'' sections. The ''Practical API Design'' book does not contain such section itself, however that in no way means that there it is not helping to solve problems! You can bet that there is a lot of useful advices! The book is a lab journal describing adventures of NetBeans project and as such, it is almost completely stuffed with problem solutions. Here is short [[Have You Ever Wondered|online]] version of [[Have You Ever Wondered]] to demonstrate that. Visit the [[Have You Ever Wondered|page]] and check yourself what problems can [[TheAPIBook]] solve for you!
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 20:42, 17 August 2008 (UTC)
 
-
 
-
==== Request/Response Pattern Revisited ====
 
-
 
-
Here is few additional [[Blogs:JaroslavTulach:Practical Design:Request/Response Pattern Revisited|thoughts about Request/Response]] which did not make it into [[TheAPIBook]]'s explanation of [[APIDesignPatterns:RequestResponse|Request/Response]] pattern.
 
-
 
-
--[[User:JaroslavTulach|JaroslavTulach]] 21:02, 25 June 2008 (UTC)
 
<endFeed />
<endFeed />

Current revision

Contents

Practical Design

Marketing Version

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!

Do not expose DeepHierarchy of classes when designing an API!

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

Using record on any JDK!

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)

2021: Code VSCode UI in Java

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!

Image:Vscodehtmlui.png

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

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)

Run on JDK8, use JDK11 APIs!

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)

Helidon MP 2.0 supports GraalVM NativeImage

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)

Available on Safari Books Online

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)

TenYears of the Practical API Design book

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!

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)

Singletonizer API Design Pattern

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?

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

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

Bck2Brwsr 0.20 - the Radtouren 2017 Release

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)

Codesnippet Doclet 0.20 Release

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

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

Beware of DefaultMethods

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)

Test your APIs Easily with Maven SigTest Plugin

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)

Boost Your Career: Become an API Tester!

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)


Improve Javadoc of Your API: Stop showing crappy code samples!

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)

Java Modularity in the Context of JavaScript

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)

ConfigurationObject Pattern in Java

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!

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)

Impossible. Part II.

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)


Publish Bck2Brwsr Libraries as Maven Artifacts

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

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

Bck2Brwsr and Images as Resources

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.

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)

Lambdas Go Bck2Brwsr!

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)

Use NetBeans to Deploy Everywhere!

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)

MineSweeper on iOS

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?

Image:MineSweeper-iOS.png

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

TeaVM Can Execute DukeScript Applications!

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)

Avoid Synchronization Problems

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

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

Changes: HTML for Java, videos and hosting

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)

Can Deserialization Change Value of a Final Field?

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

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)

Bck2Brwsr Goes Server Side: Run the Same Code on Server and Client!

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

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)

Introducing FXBrwsr

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)


Javadoc for Coding for Your Browser Published!

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)

C++ May Not Be As Bad As Thought!

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

OlderBlogPosts...

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

Personal tools
buy