Language Creep

Posted by Kerry Mon, 16 Apr 2007 21:28:00 GMT

Elliotte Rusty Harold: Type Inference: Another Bad Idea for Java 7

Type inference actually makes some sense in languages like JavaScript and PHP that are built around this, and had this feature from day 1. It makes no sense in a language like Java that’s built around the opposite. It makes Java look weakly typed, but it isn’t. In fact, if anything this is now more strongly typed…

Good analysis of a bad idea. I really dislike the idea of adding more and more language features that require new syntax or something like described in the above article. It just makes it confusing. Either create a new Java which has all the old crap tidied up, or go ahead and write a new language that can run on a JVM which has all the features and language constructs you need.

This is why I really like Smalltalk. There are very few reserved words, and the language is highly extensible so you can go ahead and implement new ideas without breaking anything old, requiring arcane syntax, or making the language less usable. Ruby struggles in this area also due to all the different ways of doing something.

Simplicity has a lot going for it.

Tiny Types

Posted by Kerry Sun, 15 Apr 2007 13:14:00 GMT

Darren Hobbs: Tiny Types

I consider it playing to the strengths of a statically typed language.

I like this pattern, and have used it once on a large Java project. Generally I prefer dynamic languages, Smalltalk and Ruby etc, but if you have types why not use them effectively.

Blaine Buxton puts it in terms I like:

Tiny objects make unit testing easier, aid in reuse, stop duplication dead, provide for better messages when things do break, puts functionality closer to where it is used, and I could go on all night.

I don’t necessarily use this all the time, I find a lot of developers reject the idea because of the number of Types you end up with. If I’m working on something of mine, or from scratch then I’ll use this approach, otherwise I tend to stick to the style of the original author.

One thing I’m not sure about is an example Darren wrote:

It’s much harder to accidentally pass dollars into a method that was expecting pounds sterling (but actually took a double so it could have been anything).

Money is money is money, would some methods really only take Sterling and not Dollars? Ever? Maybe this was a passing comment or maybe I don’t get this particular example.

This is a good technique to learn and I’d encourage anybody who hasn’t used it to give it a go. Maybe you’ll like it or maybe not, at least you’ll know. One really good outcome that I find is behaviour finds itself in a Class where it belongs, not in some Manager/Helper class just because it’s the first place the behaviour is needed. Not only does this technique work for primitives, but it works equally well for collections, especially where you have some find/collect type methods.

Ruby all the way down 2

Posted by Kerry Sun, 15 Apr 2007 11:09:00 GMT

Avi Bryant on implementing all of Ruby in Ruby:

To me, one thing that’s wonderful about both Smalltalk and Java is that all of their libraries, including basic data structures like lists and hashtables, are implemented in, respectively, Smalltalk and Java.

When Ruby is fast enough to implement most of it’s standard library in Ruby then it might lose the scripting label which seems to be hanging around it’s neck. There seem to be a few other efforts going on to implement the language, incluing JRuby, and they can only contribute to making Ruby better.

Also efforts like this wiki are a good idea as well.

Why new Smalltalk like IDEs?

Posted by Kerry Wed, 11 Apr 2007 11:17:00 GMT

Blaine Buxton in Java VM Puts Shackles On Development Tools

…in 2007 with dynamic languages finally getting recognition that few people are screaming for the capabilities of a Smalltalk VM. The productivity of Smalltalk owes not only to its dynamic nature, but to its always running and lively IDE.

Developers coming from traditional environments just don’t have the exposure to that way of working. It probably never crosses their mind that an environment that is “alive” is more productive. The only way a Smalltalk like environment would happen for another language is if it is written by somebody coming from Smalltalk and wanting the same tools.

I for one would be all for a Ruby IDE that was essentially an image.

Higher Order Messaging in Ruby

Posted by Kerry Thu, 05 Apr 2007 19:16:00 GMT

Kevin Bullock: WARNING: Deep magic ahead!

I stumbled on a concept called Higher-Order Messaging (HOM) today. It’s a handy way to allow an object-oriented language to call a message on all members of a collection without having to manually iterate over the collection…

This is quite nifty, I’m not sure the deep magic label is warranted though. It’s well worth reading through to the end, especially if your not so familiar with the way Ruby can be used to create new language features as described.

Some of the comments completely miss the point, but thankfully are pulled up as such.

A quick ruby screen scraper

Posted by Kerry Mon, 02 Apr 2007 16:42:00 GMT

Ruby Screen Scraper in under 60 seconds

Cool.

For those trying this out on Gentoo and are wondering why Firebug won’t open, you need to enable the “mozdevelop” USE flag.

A poor 2 weeks for tech

Posted by Kerry Sun, 01 Apr 2007 18:56:00 GMT

So the last 2 weeks have been abysmal when it comes to tech in my household.

Firstly, my Western Digital Netcenter crapped out. It seems that the disk is totally screwed. Not great for something 9 months old.

Then after doing an emerge the dri for the Ati graphics card in my laptop totally borked, still haven’t got it working again, and I’m not even sure what the problem is. So no mplayer on my laptop at the moment, this isn’t that bad since all the media was on my Netcenter.

Then this morning something I really didn’t want to happen happened. My server was powered off, and it won’t power on. This stores all my code in svn, present and past company documents, and most of the important stuff I work on. It was periodically backing up to the Netcenter. After a quick trip into town and a visit to Maplin for an external USB sata hard disk caddy, I managed to get all the data back. The disk is fine but it looks like the power supply might be toasted.

Oh well, here’s looking forward to a better couple of weeks coming up. It’s certainly time to go for something more permanent in the data storage/backup arena, and maybe a UPS to boot.