Tim MacFarlane posts on continuations in C# (be sure to continue). Java 7 cannot come quickly enough.
Wednesday, February 17, 2010
Monday, February 15, 2010
I require a ... subtle Scala
C++ is complex in part because it is multi-paradigm. That is, C++ supports many styles of programming. It is a rabbit hole, but a necessary one—no one likes to hear "sorry, you can't do that".
Scala is so exciting a follow-on to Java in part because it too is multi-paradigm. Witness Jesse Eichar on self-annotation:
- class Base {
- def magic = "bibbity bobbity boo!!"
- }
- trait Extender extends Base {
- def myMethod = "I can "+magic
- }
- trait SelfTyper {
- self : Base =>
- def myMethod = "I can "+magic
- }
But the two are completely different. Extender can be mixed in with any class and adds both the "magic" and "myMethod" to the class it is mixed with. SelfType can only be mixed in with a class that extends Base and SelfTyper only adds the method "myMethod" NOT "magic".
Why is the "self annotations" useful? Because it allows several provides a way of declaring dependencies. One can think of the self annotation declaration as the phrase "I am useable with" or "I require a".
Java is my daily bread and butter (and puts food on the table). There is no easy way in Java to express this subtle point of inheritance—delegation is the closest you come.
In C++ the template system lets you parameterize your base class which you cannot of course do in Java:
template<class T> class template_base_class : public T { };
Saturday, February 13, 2010
Billions and billions
Lambda the Ultimate brings me A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in the Real World. These fellows have a wicked dry sense of humor. Typically:
We thought this approach was bulletproof. Unfortunately, as the astute reader has noted, it requires a command prompt. Soon after implementing it we went to a large company, so large it had a hyperspecialized build engineer, who engaged in the following dialogue:
"How do I run your tool?"
"Oh, it's easy. Just type '
cov-build
' before your build command.""Build command? I just push this [GUI] button..."
Hilarity ensues. Unfortunately the article generated only one comment:
I hugely enjoyed this article. I can't think when I last read an article that made so many important points. Thanks for not sugar-coating the description of real-world problems and real solutions. And thanks for not drowning those points in jargon.
— Bjarne Stroustrup, January 29, 2010
Happy President's Day.
Tuesday, February 09, 2010
Scala is Java, or how to grow to love the bomb
Twitter's Nick Kallen posts Why I love everything you hate about Java, a satisfying read about Scala, scaling and design patterns in the real world. More authors (including myself) should post like this.
That he dispenses with explanation why a Java article is really about Scala evidences this fact: Scala is Java, or what Java could have become in a better universe.
UPDATE: Why I love the blogosphere, also entitled Why I hate everything you love about Java courtesy of Roman Roelofsen.
Wednesday, February 03, 2010
Snakes on the backplane
This presentation is so delightful, I weep that I was not present. And when I thought it could not get better, I learned the term duck-punching. Where have I been?
Tuesday, February 02, 2010
Scala on Cygwin: Help from Andrew Beacock
Andrew Beacock posts exactly the advice I needed: how to get the scala prompt working on Cygwin. Thanks!
Google has the best Java engineers
Are you reading Jeremy Manson? Why not? (Hint: yet another reason finalizers are wrong even if Gosling won't say it. Alternatives here.)
Monday, February 01, 2010
Against magic
A wonderful post against magic by Stephan Schmidt.
Remember: If you don't understand it, don't use it.