Herding Code 58: Presentation Patterns with Jeremy Miller, Ward Bell, Rob Eisenberg and Glenn Block (Part 2)
How about that? You stuck around! It was the Waylon Jennings, Good Ol’ Boys, Dukes of Hazzard, freeze frame cliffhanger at the end of Part 1 which hooked you, wasn’t it? Undoubtedly you have been on the edge of your seat for days, just waiting to see how the show turns out. Well, wait no [...]
Herding Code 57: Presentation Patterns with Jeremy Miller, Ward Bell, Rob Eisenberg and Glenn Block (Part 1)
Have you seen the circus gag where clown after clown emerges from the smallest car one could possibly image? Well, this week on Herding Code, the guys attempt that very same trick! Listen in as Jeremy Miller, Ward Bell, Rob Eisenberg and Glenn Block (that’s right, four guests!) join the cast and talk Presentation Patterns. [...]
JavaScript: Not for the faint at heart?
Script# (Script Sharp) – writing javascript in C#
Both Jimmy and roy have great posts discussing JavaScript. Roy is looking at it as a C# developer lured by the many, many articles about how jQuery is the only thing that makes JavaScript worth using and using Script# to abstract away some of the messiness and pain usually associated with writing JavaScript. Jimmy discusses the merits of JavaScript itself and how it has changed how he approaches writing C# code.
One thing I like to point to is a great quote I heard on Twitter
Java is to JavaScript as ham is to hamster

JavaScript actually has more in common with Scheme or Lisp than it does Java or C#. I first realized this when I saw that Douglas Crockford had re-written all of the examples in The Little Schemer
in JavaScript. It’s easy to miss that fact when you see all of the pseudo OOP noise like “var foo = new Foo();”. But when you see how trvial it is to implement something like a map method in JavaScript, you realize how powerful the language can be. Most of the hatred for JavaScript comes from two things I’ve found:
- Broken DOM implementations – every browsers implementation of the DOM is broken in one respect or another.
- A misunderstanding of either scope or inheritance.
Roy has a great point about the lack of good tooling surrounding JavaScript. There are excellent libraries like jQuery and PrototypeJS, but the usual tool support, intellisense, re-factoring, profiling, is a little more difficult to come by. I’ll address this in another post as I feel a lot of people are new to JavaScript and are struggling along with some substandard tools.
A simple map function for plain JavaScript arrays
So this isn't anything new, but sometimes you have to work with plain JavaScript and can't lean on a library. I thought I'd put this out there. This is my map function. There are many like it, but this one is mine.
-
Array.prototype.map = function(fn) {
-
var r = [];
-
var l = this.length;
-
for(i=0;i<l;i++)
-
{
-
r.push(fn(this[i]));
-
}
-
return r;
-
};
note bene: Why do I declare the "l" variable at all instead of just checking i against this.length directly? The JavaScript for loop is much faster if you don't perform the length lookup and instead check against a static value.
Herding Code 56: Markus Völter on Model-Driven Development, DSLs and Product Line Engineering
You know Markus Völter as the founder and voice of Software Engineering Radio. Well, this week on Herding Code, Markus finds himself on the other side of the microphone – fielding, rather than asking, questions. Listen in as Markus explains model-driven software development and product line engineering. Learn about modeling, domain-specific languages, code generation, Eclipse, [...]


