1. Rounded Corners - 108

    February 28th, 2007

    Slow and steady. From Pessimal Algorithms and Simplexity Analysis: “Intuitively, a reluctant algorithm for a problem P is one which wastes time in a way that is sufficiently contrived to fool a naive observer.” There’s no shortage of practical applications.

    Side effects. Is it just me, or does anyone else notice the Haskellers taking over Reddit and the Lispers quietly disappearing? I wonder if it’s a function of this, or a side effect of this?

    Don’t over-engineer. Evan Weaver: “If your model behaviors aren’t mutually exclusive, don’t subclass.”

    Spot hunters. “OH my God. A lot? Why doesn’t she just drag me out of the car and castrate me?” Street parking is serious business.

    The need for social refactoring. “While the male:female ratio in the software industry is between 7:1 and 12:1, depending on how you measure it, the ratio in open source is at least 200:1, and probably worse. For a community that talks so loudly about freedom and rights, I think that’s shameful.” (Via Simon Willison)

  2. Dear Valued Customer …

    February 28th, 2007

    Dear Valued Customer,

    Thank you for submitting your suggestion. Our suggestion box is always open for you.

    We understand that you would like to rm -rf /windows, or at least rm -rf /crapware. Unfortunately, we do not understand what either of these means, and are unable to assist you at this time.

    Rest assure that we are listening to your concerns, and are working together with our partners to secure a future in which we can offer you machines pre-loaded with Microsoft Linux at no extra savings for you.

    Once again, thank you for your suggestion, and have a nice day.

    P.S: As a courtesy, our service department would like to remind you that replacing the operating system on your machine voids your warranty.

  3. WS-Configuration

    February 27th, 2007

    Elliotte Rusty Harold: “There’s a large rebellion over XML config files from programmers who don’t like to type XML and don’t want to learn APIs for processing it. They’d rather limp along with the same scanf code they’ve been using for the last 20 years.”

    Hmmm, ok.

    No, not ok. I actually find this statement offensive, and it’s bugging me. The undertone is clear: “you either use XML, or you’re too stupid/lazy to understand it, go learn some”.

    So no, not ok. Eight years of implementing XML technologies, writing about them, explaining them to others, fishing for bugs, optimizing code, I think just about qualifies me for what I have to say.

    It sucks.

    grep DocumentRoot /etc/httpd.conf
    sed s/wrong/right/ config.rb > config.rb

    But if you’re handing out dunce hats, I’ll wear mine with pride. Everytime I cut loose of one more XML configuration file, I get more work done, have fun doing it, and leave the office at a reasonable hour.

    If that’s the price I have to pay, it’s one hell of a bargain.

  4. Validating XML documents with Ruby code

    February 27th, 2007

    A simple DSL to keep it short and simple, declarations to define the structure, and imperative code to handle that which can’t easily be declared. Just a rough sketch, but wouldn’t this be easier than half functional XML Schema?

    validate do
      email.optional
      phone.optional
      im_handle.optional
      raise "Must specify at least one means of contact" unless
       email || phone || im_handle
    
      address.required do
        street.required
        city.required
        state.optional
        country.optional :default=>"US"
        raise "State required for all addresses in the US" if
          country == "US" && !state
        raise "Zipcode does not match the rest of the address" if
          valid_zipcode?(street, city, state, country, zipcode)
      end
    
    end
  5. Rounded Corners - 107

    February 21st, 2007

    So you can do it in five lines or less… Steve Jones: “Maintenance is the hardest part of IT, writing code that survives for 5, 10 or even 20 years should be an achievement, not writing something 20 seconds quicker than the bloke sitting next to you.”

    I know in five years, on one can afford to pay me enough to maintain this piece of code:

    ((DataSource) new InitialContext().lookup("java:comp/env/jdbc/myDB")).getConnection();

    Less off. A quick refresher in using lsof (Daniel Miessler).

    RESTful Rails. About 30 pages of RESTful goodness and Rails elegance. (Via Ruby Inside)

    Slapped together. Can you use one architecture to overcome the limits of another? “This article proposes the use of a facade component for providing a REST-style interface to existing SOAP-style Web services.”

    Simple Oriented Architecture. I’m following some recent discussions on the punditsphere, and I got to hand it to the WS-* folks. They’ve managed to tangle the S in WS-* with the S in SOA. Works wonders on buzzword driven architects, especially when you can’t clearly articulate why limited endpoints are better than vast resources, or the other way around.

    So let’s repeat this together: “Simple-Oriented Architecture works better. Simple-Oriented Architecture is not just for the services. Simple-Oriented Architecture means less work today, and less maintenance tomorrow”.

    Cuteness overload, via Jeremy Zawodny

  6. Verizon: We take usability seriously

    February 20th, 2007

    verizon1.png

    Changing the bookmarks on my cell phone’s browser is not an easy affair. Practice makes perfect, but usually I’m too busy filing taxes and visiting the dentist. But, once in a while I bump into a service that’s worth adding to my cell phone.

    Fortunately, Verizon never stop working for you, and implemented a Web site you can use to change your phone’s bookmarks from the comfort of your own Firefox (I heard it also works with Safari). And it couldn’t be any easier.

    1. Login to your VerizonWireless account using your username and password.
    2. Realize it’s not there, hunt for the link that says Mobile Web.
    3. Get redirected to the GetItNow site (aka ‘we never stop billing you’).
    4. Login to GetItNow with your phone number and PIN.
    5. Hunt for the page for changing the Bookmarks/Favorites.
    6. Get redirected to the VZWeb site (no, not the texting site, the VZWeb site).
    7. Login with your phone number and *other* password.
    8. From the page that shows all the useless bookmarks you never use, pick the Custom option.
    9. Add a link.
    10. There is no step 10.

    If everything in life was that simple …

  7. Rounded Corners - 106

    February 19th, 2007

    refuctoring.jpg

    Refuctoring. Job Secrurity Index = 1 / Maintainability. (PDF, NSFCS)

    ActiveRecord goes Geo. Simplifying database access is a Good Thing. But ActiveRecord goes beyond Plain Old SQL, and lets you build a lot of smarts into the library, to make coding all that easier. What other database layer will let you do this?

    Store.find(:all, :origin=>'100 Spear st, San Francisco, CA',
               :conditions=>'distance<10')

    That’s one line of code to geo-code the address and query by proximity. All courtesy of Andre Lewis’s GeoKit plugin. If you’re doing anything with maps, check it out. It doesn’t get any easier than this. And I heard the book is coming out soon.

    Why go? 365 million years of evolution/closures in Java debate, explained.

    Web 2.0 prank sites. For when you have nothing better to do.

    The Rails idiom. Peter Harkins, when reviewing assert_select: “I’ve mentioned that this is what coding in Rails continually feels like: sometimes it just feels off even though it works and is nicer than other languages, and soon I realize a beautiful Right Way to do it.”

    Amazingly it feels better, simpler and tighter in every release, without the inevitable bloat that fates other frameworks. Maybe bloat is avoidable afterall.

  8. Rounded Corners - 105

    February 14th, 2007

    If a Blog Falls

    Testivus. Alberto Savoia’s testivus manifesto, or testing for the rest of us:

    -Less testing dogma, more testing karma
    -Any tests are better than no tests
    -Testing beats debugging
    -Test first, during, or after – whatever works best for you
    -If a method, technique, or tool, gives you more or better tests use it

    Programming Language Stories. Best read from beginning to end.

    FUBAR. Of the 5 dysfunctional attributes of good engineers.

    EJB over HTTP. The SOA Facts page is still growing, with new gems like:

    • SOA actually stands for Same Old Architecture - whatever your old architecture is.
    • Implementing SOA for the first time is the triumph of imagination over intelligence.
    • Implementing SOA for the second time is the triumph of hope over experience.

    Via Tim Bray who also links to the proposed Java RESTful API. I hope it will end up like this, though right now it looks dangerously like this.

    And not a decade too soon. Stephen Colebourne: “I am now seeking to gather as many views, opinions, feedback and ideas as possible from anyone who has ever found Date or Calendar to be a real pain.”

  9. Rounded Corners - 104

    February 11th, 2007

    Google 1337. The Google search engine, translated to H4×0r. For more fun, here’s the pR1V@CY poLICY. (Via Phil Windley)

    Apropos Google …

    Suggestive. Antonio Cangiano brings us acts_as_suggest. I don’t think people get it: ActiveRecord is Web 2.0.

    I heard people argue about the merits and drawbacks of ActiveRecord, mostly drawbacks compared to their ORM of choice. But I know of none that can be tweaked as easily, and has an increasing collection of plugins and extensions. A thriving community of users that do not work on the codebase, yet are contributing to the overall and deriving immediate value. Sounds familiar?

    It’s all technically possible because …

    Everytime you meta-program, God kills a for loop. Just wanted to say that, no particular reason.

    Speaking of for loops …

    In one line or less. This week’s Ruby Quiz is all about one-liners. Some functional iterations involved.

    And, from our “because you have too much time” department …

    Cats or dogs? “People who prefer spaces to tabs are 2.0 times more likely to prefer less to more.” And other pearls of wisdom from our collective taste buds.

  10. How well do you know Java?

    February 10th, 2007

    My recent post, Timing is everything, started a mini-controversy. One that can teach you a lot about where Java is coming from, and where it’s heading.

    Smart readers pointed out that Java’s raw performance will more than make up for any cost of startup time. Others pointed that so many applications are started once and left running for years. Those are all good and true.

    So let me ask you this question: how well do you know Java?

    I didn’t write the post to claim Java has a slow startup time, I wrote it to propose a different way of measuring things that will include the startup time. And in doing so I hit a few nerves.

    So let’s take a break and look at the numbers for a second.

    I’m measuring this on a 2GHz Duo Core 2, running Linux. The startup time for the JVM (Java 1.5) is 30x slower than the startup time for the Ruby interpreter (version 1.8.5). 30x is a freaking large number. But remember from my post that I wasn’t looking for relative numbers, but how long I, the user, am going to wait. How long?

    About 0.1 seconds.

    As fast as a blink.

    This is 2006. In ‘96 the startup time for the JVM was a serious issue you had to work around. Those days are long gone.

    There’s no need to propose theories that explain and rationalize the incredibly sluggish startup time that never was. Java does not need to be excused.

    Proving this is just a matter of firing up the command line and running:

    time java Test
    time ruby test.rb

    Of course, it uses time. And people who are caught in the slow startup myth, have a subconscious gag reflex when it comes to time. It’s amazing how myths can play with your head.

    I ran this little test at home, so I knew Java didn’t have to worry about its startup speed. It’s more than adequate.

    If your initial thoughts were to rationalize the supposedly poor startup time of Java, my apology for not laying out all the facts. But consider this. You may have internalized limitations of the language that no longer exist. Your knowledge of Java might be burdened with believes and myths, instead of facts.

    In which case that post was written for you. Software adapts, hardware improves, requirements change. And every once in a while, we need to step back, forget all that we believe is true, and look at the situation with a fresh eye and an open mind. To judge that which is true now.

    The point of my post was not that Java sucks and Ruby rocks. The point of my post is that, in the Java world, we still build software like it’s 1996. It’s time we let go of old believes and move on.