Paul Buchheit On Amazingly Bad Java APIs

Paul Buchheit, who was employee #23 at Google, is blogging about what he sees as the benefits of Python over Java. Paul doesn’t like Java APIs - he thinks they are “amazingly bad”; and he dislikes what he believes are “Java fashions” in coding. Paul makes some valid points, but his central thesis - that Java APIs are in general amazingly bad - is not one I can agree with. He takes his examples from the field of imaging. Paul says,

(While working at Google) I learned that one of the hot fashions in Java is to use factories instead of ‘new’.

Well hardly. In any case, factories are hardly unique to Java. Here’s some Python code that uses the main Python image api - it instantiates an image object.

image = Image.open("CoolPic.jpg")

This, folks, is what is known as a… factory; it makes an image object, given a jpeg file as a raw material. How about if we want to create an image object from scratch in Python? Say, an RGB image of size 200 pixels by 200 pixels. Well, we do it like this:

image = Image.new('RGB', [100, 200])

Yep, another factory. Amazing, eh? Well, no, not particularly. The truth is that factories are useful in many circumstances in object-orientated programming… And, the truth is also that there are good and bad APIs in Java; and there are good and bad APIs in Python. No one language has a monopoly on bad APIs I’m afraid…

(See Paul’s blog - Amazingly Bad (Java) APIs)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*