KBD

Keith Devens .com

Saturday, May 17, 2008 Flag waving
Philosophy: the finding of bad reasons for what one believes by instinct. – Brave New World (paraphrased)

Tag: Java

Parents:

Daily link icon Friday, August 31, 2007

  1. RussellBeattie.com - Java needs an overhaul (via):

    There's something about the Java culture which just seems to encourage obtuse solutions over simplicity.

    I was bemused when Sun changed their ticker to JAVA the other day; it's a name they won't want to be associated with in a few years. Kinda surprised they want to be associated with it now tbh... this isn't 1999.

       (0) Tags: [Java]

Daily link icon Thursday, July 5, 2007

  1. Matt Raible relays comments from Don Box:

    Richard Monson-Haefel asks "Is there a place for AOP in .NET or is it too sophisticated for your developers." Don's take is "My development platform should allow me to write code w/ a couple of beers in me." He ragged a bit on Java developers and said their main problem is they think they're smarter than they are. He also said that if he could change on thing at MSFT, it would be that Ruby becomes the language of choice.

       (0) Tags: [Java, Microsoft, Ruby]

Daily link icon Wednesday, May 9, 2007

  1. Labnotes » Buildr, or when Ruby is faster than Java:

    Somewhere in my ever expanding list of drafts I’ll never get to finish is another post about the economics of Ruby, and how raw performance is less of a problem when you’re bound by the database, spend less on development, and can optimize in the large. Basically, regurgitating the same justifications I used to explain Java a decade ago.

    But this is not that post.

    Today, I’m going to talk about something else, and share with you an interesting discovery from working on Buildr. There will be no language theologies or abstractions of performance, just the facts.

    Off the bat, we downsized 5,443 lines of XML abuse spread over 52 files, into a single build script weighting a measly 485 lines. It’s amazing what a real language, with proper variables and (gasp!) functions and objects, can do.

    Of course, we’re not measuring raw Ruby against pure Java. We’re comparing one implementation against another, where they both do the same thing. Black box equivalent. That’s a real life benchmark.

    We know the Ruby-based solution performs significantly faster, is much more reliable, requires less work to use and maintain, and took all of 3 months from concept to working release.

    Ruby might be slow, but what you build with it can be devilish fast.

       (0) Tags: [Java, Ruby]

Daily link icon Tuesday, March 6, 2007

  1. json-taglib - Overview (via Simon). LOL.

       (0) Tags: [Funny, Java, Json]

Daily link icon Thursday, July 27, 2006

Dumb substring behavior in C# (and Java)

Substring in C# (and Java) throw an exception if you take a substring and give it a length (or a starting position) that puts you after the end of the string. That's basically to ensure that you always get a string that's exactly the length you want? Rather than just being able to take a substring and not having to worry about it, you have to include code like the following around every single substring you ever take:

if (str.Length > 30){
    str = str.Substring(0, 30);
}

Typically when you take a substring you want to ensure that your string is no longer than a certain number of characters. I can't think of a situation that would it a good idea for the language to enforce that you can't get a string that's less than the maximum length you want instead of exactly the length you want.

On the other hand, most of the dynamic languages (PPPR) let you substring off the end of the string without worrying about it.

Daily link icon Monday, April 17, 2006

  1. MySpace does 1.5 billion page views per day using ASP.NET 2.0. They just switched from ColdFusion, a Java based technology, and their server load went down dramatically. Of course it's not surprising that switching from Java would make your app run faster, but what makes this so ironic is that they're still largely using ColdFusion, but using a .NET-based reimplementation called BlueDragon. So, a .NET-based reimplementation of ColdFusion runs dramatically faster than the original Java-based implementation.

       (2) Tags: [.NET, ColdFusion, Java]

Daily link icon Thursday, March 16, 2006

Asinine accessors, or preposterous properties

Was just reading this post by Jeremy Miller (via Keith) and some of the code in it has forced me to write this post, completely unrelated to the topic of Jeremy's post.

So often I see people writing properties that look like this:

public DateTime InvoiceDate
{
    get { return _invoiceDate; }
    set { _invoiceDate = value; }
}

public string InvoiceNumber
{
    get { return _invoiceNumber; }
    set { _invoiceNumber = value; }
}

Damnit people, C#'s has its properties so that we don't have to go and write accessors for all public properties like people do in Java. Make it a public data member and be done with it until you actually need custom behavior. Otherwise you're just needlessly writing code around what C# already does.

Update: There are actually two cases where you would want to define "unnecessary" properties such as these. Adam explains the case of Winforms Data Binding:

Properties and member fields are treated differently by System.Reflection. You can databind to an object property, but not a plan old member.

...

The sad thing is that both MemberInfo and PropertyInfo, the classes that encapsulate field and property access, both have "GetValue" and "SetValue" members, but they're not defined in the base class nor with a common interface, so you can't use these interchangeably.

The other case is if you're writing code specifically to be distributed as a dll. Even though the syntax is the same, the generated code is of course different, and changing from a member to a property would require a recompile of the client code.

Daily link icon Monday, March 13, 2006

  1. I forgot to link to this example of elegant Java code from Sun.

       (0) Tags: [Java]

Daily link icon Sunday, March 12, 2006

  1. Lesscode.org has an enormous post on James Gosling's recent idiotic comments. DHH, creater of Rails has also has comments.

    Ryan at Lesscode concludes thusly:

    All we’re asking is that you stop spreading misinformation about the current state of dynamic languages to the press, analysts, and your customers. This does not require you to champion or otherwise support these technologies - just stop lying about them. One year ago, this type of behavior could be attributed to a lack of documentation and discussion on these issues, today it’s impossible to attribute to anything but malice.

       (0) Tags: [Java, Programming languages, Ruby, Ruby on Rails]

Daily link icon Sunday, February 26, 2006

Alan Kay speaks

Bill Clementson's Blog: The Most Important Idea in Computer Science (via Chris Double).

Favorite quote, from Alan Kay: "Java is the most distressing thing to hit computing since MS-DOS." Note that Kay is one of the inventors of Smalltalk.

Update: Phil Windley - Alan Kay: Is Computer Science as Oxymoron? Phil was at the talk and has lots of notes from it. Worth a read. Via Paul Hammond.

Daily link icon Saturday, January 7, 2006

  1. "Friends don't let friends code Java" (via lesscode.org):

    The Java version of the BirthdayOrganizer backend, which I won't even bother linking to, is well... ginormous. 246 lines of XML configuration sludge in 5 files, 29 lines of SQL schema in 1 file, and 3004 lines of Java code in 45 files. Holy crap. If you add that all up, the trivial BirthdayOrganizer example is only a hair shorter than all of flashticle! And the BirthdayOrganizer example builds on top of 15 Java dependencies and requires a J2EE server plus ant. Friends don't let friends code Java. Oh, and it's also MySQL specific, but you better be damn well sure that there's a stub implementation you can subclass and an XML file you can mangle in order to support something else if you so choose to write that 200 lines of code to support a single three column table database.

       (0) Tags: [Java, Programming]

Daily link icon Thursday, November 24, 2005

  1. Evaluation: moving from Java to Ruby on Rails for the CenterNet rewrite (via John Wiseman). To read.

       (0) Tags: [Java, Programming, Ruby on Rails]

Daily link icon Wednesday, October 12, 2005

  1. PragDave: Is Ruby Better Than ...?:

    ... I’d rather write in a language that let’s me focus on the application, and which lets me express myself clearly and effectively. And, if I can do those two things, I believe that sometimes I’ll be able to write code which is cleverer than something I’d write in a lower-level language. A better algorithm will easily gain back any marginal performance hit I take for using a slower language.

    Justin Ghetland experienced this recently on a Rails project. Having coded the same application twice, once in Java and once using Ruby on Rails, he was surprised to discover that the Rails application outperformed the Java one. Why? Justin believes it’s because Rails does smarter caching. The Rails framework contains some very high-level abstractions, and that allows the folks writing the framework to be smart about what they do. They accepted the linear hit of writing in a language that executes more slowly because they got a non-linear increase in speed from being able to write better code.

    Similar point covered earlier.

       (2) Tags: [Java, Ruby, Ruby on Rails]

Daily link icon Friday, September 2, 2005

Regular expression quick reference for different languages

Java:

import java.util.regex.*

Pattern foo = Pattern.compile(regex_str);
foo.matcher(str).replaceAll(replacement_str);

More coming later...

May 2008
SunMonTueWedThuFriSat
 123
45678910
11121314151617
18192021222324
25262728293031



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

new⇒Maps of Iraq

my husband is in Scania too..he​says it's not too bad..he's been at​worse...

Cristy: May 16, 3:54pm

"IMDB for music"

IMDB for Music? It looks to be a​couple of years old...​http://MusicTell.co...

Ken Empie: May 14, 9:57pm

Generated in about 0.298s.

(Used 10 db queries)