Archive for January, 2008

JSun Runs JRails on JRuby

I find it pretty cool that Sun is already able to run Rails on JRuby, and actually is doing so in production according, to Igor Minar:

…I suggested that we could try to rewrite the app in Rails and deploy it in a regular Java web container, thanks to JRuby and Goldspike. It took some time for Rama to give us a go-ahead, but finally in late September, two other colleagues (with no Rails or JRuby experience) and I started to work on the rewrite alongside our other projects (forums.sun.com and wikis.sun.com).

The ability to access and seamlessly integrate with existing or new Java code is a huge plus without which we would not have been able to launch this project successfully

The site in question is mediacast.sun.com.

That’s eating your own dog food.

I am very impressed by the speed with which JRuby seems to be coming along, a perception born of notable milestones like this and the continued updates that Charles Nutter posts to the ruby-talk mailing list. I like it.

No Comments »

chris on January 29th 2008 in /dev/ruby

Who Needs Ruby When You’ve Got…?

Reg and Obie both link to this job growth trend graph that purports to show the relative climb of Ruby jobs vs. Java jobs:


ruby, java Job Trends graph

ruby, java Job Trends ruby jobs - java jobs

Looks good, looks good. But not as good as Lua:


ruby, java, lua Job Trends graph

ruby, java, lua Job Trends ruby jobs - java jobs - lua jobs

Take that Ruby! Suck it Java! PHP: don’t even bother showing up.

2 Comments »

chris on January 26th 2008 in /dev/random

Follow-up Reading on “Computer Science”

It seems the conversation on the web about the nature of “computer science” is growing, now encompassing such bandied-about terms as “software engineering” and in my mind generating more questions than answers, which is great because questions are almost always more fun than answers anyhow.

The comments on my Two Thoughts On Computer Science Courses are mostly excellent and interesting, especially the ones from real-world students and post-students about their experiences.

Simmoril’s Domain’s If It’s Worth Having, It’s Worth Working Hard For weighs in on the difference between just creating your software and actually understanding your software.

João Ferreira’s The programmers of tomorrow posits that:

in my opinion, the problem starts before university. The maths’s programs in secondary schools are also being simplified (or dumbed down, if you prefer) and many important concepts, like logic and proofs, are being ignored.

In result, first-year students usually have a poor background on maths and problem solving. In fact, most of them have never seen a proof and don’t even understand the importance of mathematical reasoning. With poor reasoning abilities, they become intellectually less curious, accepting things as they are presented, and they have tremendous difficulties creating new algorithms, or convincing someone that their own algorithms are correct.

I really like that post.

And finally Ravi Mohan threatens to stir up a hornet’s nest in Ratcatchers and Engineers, an article I want to disagree with if only I didn’t agree with it so much.

In my career I have steadfastly fought against ever having “Engineer” in my job title (in one case it really was a fight) for three specific reasons:

  1. I have never proven my software mathematically before building it (prototyping code may seem equivalent to engineers building models but it isn’t). I believe that if you can’t prove your model you haven’t actually engineered anything. And 90% of all software functionality documents I’ve seen are about as analogous to an engineering blueprint as a finger-painting is to the Sistine Chappel.
  2. I have no accreditation with any body that will stand behind me, and I am accountable to no such body in the event of failure. The IEEE and the IIE, as examples, exist for these very reasons.
  3. As someone who’s father actually is an engineer (Elecrical), to call the way in which most popular commercial and web-based software is developed “engineering” strikes me as an insult to those who are actually capable of performing feats of engineering.

Cooking a mean chilli that everyone really likes don’t make you a chef.

No Comments »

chris on January 23rd 2008 in /dev/random

MySQLDump: Dumping Just the Schema

I always forget the syntax for just dumping the schema of a database:

~/: mysqldump -u root -pmypassword test_database --no-data=true --add-drop-table=false > test_dump.sql

1 Comment »

chris on January 21st 2008 in /dev/random

Two Thoughts on Computer Science Courses

ekinoderm’s “Who did Kill the Software Engineer?” ruminates upon Robert Dewar and Edmond Schonberg’s excellent “Computer Science Education: Where Are the Software Engineers of Tomorrow?” (both well worth reading) and fostered in me two thoughts about computer science classes:

I can remember students in my classes constantly grousing about how topics like Scheme or Finite State Automata were “useless” and we should spend our time doing “useful” things like learning how to use VB to make a database app or something.

the adoption of Java is driven almost entirely by a desire to make programming “fun” and to alleviate students’ fears that they won’t learn anything “useful” from a course taught in an academic language like Scheme

My first thought: if your comp-sci course is easy then you’re either a genius or you’re wasting your money. The odds on that are not in your favour.

My second thought: if your comp-sci course takes you to the edge of weird when it comes to computing (to put it another way: if you’re constantly thinking “when will I ever need to use this??”) then you’re probably really quite fortunate. Drink it in.

As Hunter S. Thompson put it:

When the going gets weird, the weird turn pro.

All the rest learn Java.*

Personally, after fifteen years writing various kinds of software professionally I find that every day I wish I’d had a deeper, weirder comp-sci eduction in my youth. I suspect I would have written better code sooner, understood more easier, and saved a lot of the time I’ve spent this last decade and a half playing catch-up (functional programming is a concept only two years old to yours truly… sigh) which could have been used learning even weirder stuff.

While I don’t believe that Java is to blame for the evils of modern puppy-mill comp-sci (I really try not to blame the tools) I also don’t believe I shall ever take seriously any developer who only knows but one programming language.

Or to put it in human terms, wouldn’t you laugh at someone who calls themselves a “linguist” simply because they speak English?

(*I couldn’t resist one shot)

Update 22:01: This topic seems to be one that’s growing in popularity around the web. If this is of interest to you, also check out Reg’s No Disrespect and then track back for Why You Need a Degree to Work For BigCo. And then I recommend Brian Hurt’s What good is a CS degree?. Here’s a teaser:

Here’s the kicker- there was not one class at the college I could take that would teach me C. Not one. How unfair was that? Their attitude, when the issue was brought up, was “we’ve taught you Pascal, we’ve taught you assembly language- here’s a copy of K&R, figure it out.”

One thing I want to make very clear is that I don’t believe that Java the Language is to blame. In fact, I know it because a couple of the smartest developers I’ve ever had the pleasure of working with were Java developers creating stuff that still fascinates me six years later.

It seems to me that when people blame Java what they’re really saying is “computer science has started teaching languages that are easy to teach the basics of and call that a comp-sci degree”. When put that way, what fault the tools?

From this point on should I comment on the subject I’m going to use the venerable Blub rather than Java, or VB (remember the good ol’ days when VB was everyone’s favourite whipping boy?) or ActionScript or even <your most hated language here>.

I also don’t think a degree is necessarily useless. Like every other degree it depends on where it came from, who gave it to you, and what you did to earn it. More importantly, it likely informs what you did (or will do) after you earned it: if it instilled a love of programming and seeking the esoteric then chances are you’ve got a personal project that speaks volumes about your abilities.

If you skimmed through the puppy mill to get the piece of paper you probably don’t have an interesting personal project and that says just as much, yeah?

Update 2008-01-22, 15:23: Ben asks an excellent, important question down in the comments:

What is a student who doesn’t get into the big name schools (MIT, Caltech, Stanford, etc.) do to ensure a good CS education?

If you’ve got thoughts on that please post them to the comments or even better write them up in a blog post and link ‘em. I’m really interested in hearing that answer too.

17 Comments »

chris on January 21st 2008 in /dev/random

Live Fast, Write Code

If you don’t have some downright embarrassing shit-tastic WTF-worthy code lurking in your project—I mean, the kind of thing where you see a bug report go to your coworker, and you say to him, Oh, I’ll take that one, I know that feature, but really, you’re saying Please don’t look at that code, or at least, if you do, please don’t judge me—then you probably weren’t going fast enough.

- Isaac Schlueter, “Going Fast, Frankenstein, and Refactoring”

I’ve heard it said that the difference between a good programmer and a bad programmer is that a good programmer feels pain when he looks at ugly code he’s written, while a bad programmer thinks everything he’s done is great.

- Isaac Schlueter, “Going Fast, Frankenstein, and Refactoring”

No Comments »

chris on January 21st 2008 in /dev/random

MachSpeedCalc on RubyForge

My Mach speed calculation Ruby library is finally up on RubyForge: machspeedcalc. It provides means to convert between Km/h and Mach and Miles/h and Mach (and vice versa) like so:

      => m = MachSpeedCalulator.new
      => mach_speed = m.kmh_to_mach( 120, 25 )
      => 0.0962977998319029

A bit esoteric, this I realize, but I had a need.

As this lib is only one file I haven’t packaged it at all. Jump to the Svn repo here.

No Comments »

chris on January 19th 2008 in /dev/ruby

Amazon.ca, I Think You Have Some Bugs

Attempting to order from Amazon.ca, the Canadian arm of the venerable merchant, produced this error:


amazon-no-canada

I realize Canadians are famous for self-deprecation but, well, ouch.

1 Comment »

chris on January 19th 2008 in /dev/random

A Method That Knows Its Own Name: this_method()

I realize this is the second mailing list-mining for content this week but this was too cool to not mention. Over in Ruby Forum in using the current method name within current method Aleks Kissinger, Robert Klemme, and Matt Todd hashed out a way for methods in Ruby 1.8 to know their own identity.

To jump to the end, the final solution is:

module Kernel
private
   def this_method
     caller[0] =~ /`([^']*)’/ and $1
   end
end

As an example:

class TestClass
   def this_methods_name
      puts this_method
   end
end

t = TestClass.new
t.this_methods_name

Pretty cool stuff, that.

No Comments »

chris on January 14th 2008 in /dev/ruby

Speeding up Ruby Networking on OS X Leopard

Apparently Ruby can be excruciatingly slow to do various network-related operations under OX 10.5 (Leopard). According to Ezra Zygmuntowicz (developer of merb on the ruby-talk mailing list the solution is to add this into your script:

# for OSX compatibility
Socket.do_not_reverse_lookup = true

No Comments »

chris on January 13th 2008 in /dev/random