Reunion Sucrerie 1920×1080
Just uploaded a new wallpaper from Reunion Island ![]()
Just uploaded a new wallpaper from Reunion Island ![]()
Good morning^^
I feel “angry” about the IT community drifting away from each other. There are the hard-core professionals working on enterprise-scale projects, then there are the employed software engineers working at companies like Google or IBM, and last but not least there is an in-homogenous group consisting of Open Source developers, book authors, bloggers, and technology evangelists. In the past, the gap between those groups was not that important, as the market was small and the technology less complex. We used to be a small group, curious about everything and everyone. IT was not a life-style product and the name Google was worth nothing. I agree, if that sounds romantic and exaggerated.
Personally, I think competence and life-long learning is everything, but of course in reality the association with company names and reputation as speaker or author of well-known books/software are more important to make an individual opinion relevant for others. Some people won’t even listen at all, if they consider you as not relevant or in other words: not helpful for their own career building. You always want to hang out with the cool guys and everyone should see it. I found out, after I discussed a validation issue with Martin Fowler. Some people looked at me like I must be the president of the United States because I got a reply from him. But hey, we are all just humans. Yes, I was also chatting with Niklaus Wirth, my mom, our project manager and the kids on the street – and the strange guys developing JavaScriptMVC
So far, so good. Now the problem is, that well-known opinion leaders can have stupid ideas and unknown developers that are always sitting behind the screen and fear the sunlight can have really good ideas. Also ideas presented in books sometimes do not work in practice, as we had to find out too often. A recent example is a posting from John Resig about why we don’t need jQuery Enterprise – I feel like he lost touch with reality and think some people who are not recognized as world-class JS developers do have a better understanding of what is required for large Rich Internet Applications. And why is that? Because he wants to be relevant:
"If I had to guess and put percentages on the jQuery user base I would say that they break down something like this: - 95% of jQuery user's needs are perfectly met by current jQuery code/plugins (19 out of 20 users) - 4% of jQuery user's create complex interactions - would possibly benefit from a widget architecture - 1% of jQuery users have a need for both complex widgets and a means of tying them to an existing data model"
Yeah, my current project belongs to the 1% of the market. We are not relevant, work in the underground and feel pretty uncool. Many of the “surprisingly” simple solutions, that shine brighter than daylight, do not work for us. To have a closer look takes a lot of courage and time – and nobody from the outside will take notice. There usually is no time to travel around the world and tell everyone. But if you ask, we are happy to explain. That is what the project business is like. At least you can make some money.
If you ask some employee of a larger corporation about what’s going on inside, something you will rarely find out by searching the Web, you are rewarded with interesting insights. For example, you will learn that IBM employs some no-so-bright developers and that software quality often sucks. True, IBM also has developers and marketing managers that tell you something completely different. That’s why the company name does not matter in the end, but the person as such.
Either way, and that is the good thing about our profession, the computer is always right. It does not care how cool the user is. It does not even care, if it was built by Apple or some No-Name company. It does not care how much money you have. Hard, boring binary facts do count. That’s why developers from companies large and small, well-known and unknown should always keep up communication and don’t make their attention dependent on what they think about the status of others. Good reasons and experience lead to practically relevant opinions. Of course it’s not enough to just have some random opinion, for nobody.
My computers are constantly exchanging information with networks on all over the planet and they did not ask the question about the “why” so far. There is a good reason to fight for net neutrality. My computers are not cool, but at least they do work pretty well.
The bottom line is: Do speak with strangers. Don’t feel important. Never stop learning. Forget about names and brands. From my point of view, we are one community and we need each other to grow professionally and personally.
Reading this post a couple of hours later, another conclusion comes into my mind: Maybe we could encourage more women to work as developers, if some people can forget about their ego.
What these tests do, is basically constructing Arrays and one Object (in the last test), and then output the data using a “for(var i in array)” loop. All browsers do handle objects and arrays as expected and return the data in the original order, just Google Chrome fails. That means there is no way to store data in a certain order in Chrome, if you don’t want to loop over it with “for(var i = 0; i < array.length; i++)", which can result in significant code and/or processing overhead for a number of reasons.
If all tests are green, they passed. Red results indicate failures:
Especially this comment in JavaScriptCore (Apple Safari), indicates that all browsers should preserve the order of data, as this is a de-facto standard:
// lastIndexUsed is an ever-increasing index used to identify the order items
// were inserted into the property map. It’s required that getEnumerablePropertyNames
// return the properties in the order they were added for compatibility with other
// browsers’ JavaScript implementations.
The ultimate reason behind the behavior of Chrome seems to be that a NumberDictionary is used for certain array/object keys and a StringDictionary for others (handles.cc line 554):
// Compute the element keys.
element_keys = Factory::NewFixedArray(current->NumberOfEnumElements());
current->GetEnumElementKeys(*element_keys);
content = UnionOfKeys(content, element_keys);
content = UnionOfKeys(content, GetEnumPropertyKeys(current));
Also the many type casts do look scary to me =)
Sure you could use non-numeric attributes only, but those are normally part of the inline cache. To cache offsets of arbitrary arrays does not make a lot of sense. The JavaScriptCode devs recognized just that and made it right.
Today, I prepared for the upcoming PHP/JS conferences and had a look at the mysterious bug #883 of Google Chrome and those related to it. Also I read though SquirrelFish source, which is used by Safari 4.
The reason for the odd behavior of Chrome seems to be a if/else construct that is repeated throughout the source of runtime.cc:
// Check if the name is trivially convertible to an index and get
// the element if so.
if (name->AsArrayIndex(&index)) {
return GetElementOrCharAt(object, index);
} else {
PropertyAttributes attr;
return object->GetProperty(*name, &attr);
}
Chrome makes a difference between properties and elements. And they do weird type casts. If you check JavaScriptCore, you see there is a better way:
inline JSValue JSObject::get(ExecState* exec, const Identifier& propertyName) const
{
PropertySlot slot(this);
if (const_cast
return slot.getValue(exec, propertyName);
return jsUndefined();
}
Wow, after years, I managed to create a twitter account this week. @williamluciw invited me. It’s much easier to write short tweets from time to time, than updating a blog with interesting content. On the other hand, it’s a waste of time.
The best use case I found so far, is to tell the world about things I like, things I don’t like, or bugs I find in more or less popular applications/Web sites. Stuff that would not be worth writing a full featured blog post about.
Anyway, have a nice weekend and don’t waste too much time with the internet!
There is an article about JavaScript optimization in the current issue of the German c’t magazine. I read it with great interest and there are some tips that need to be commented:
1) Declare local variables with the keyword var, to save time for searching it in the global namespace:
function foo () {
var bar = 'abc';
return bar;
}
This should always be done, for sure. However the article is wrong in that the variable will be created in the local namespace, if you don’t use var. In that case it will be created in the global namespace (which is window in Web browsers).
2) Another recommendation is to use setTimeout(doSomething, time, param1, param2,…) instead of setTimeout(‘doSomething(‘ + param1 + ‘,’ + param2 +’)', time). While this would be a good idea probably, Internet Explorer does not support it. Also the use of local object instance variables like this.value to pass parameters to functions that are later executed by setTimeout is dangerous, as the context is not preserved for setTimeout. Always use the variables in the global namespace or use the var self = this hack (might cause memory leaks) to access the current context. Two examples from the Internet Explorer Developer Center:
// The first example of a closure passes the variable to a named function.
function startTimer() {
var div = document.getElementById('currentTime');
setTimeout(function(){doClock(div)},200);
}
// The second example also uses a closure, by referring to an argument passed to the function.
function doClock(obj) {
setInterval(function(){obj.innerHTML=(new Date()).toLocaleString()},200);
}
3) Function inlining, that is not to use functions in loops but copy & paste the code, can speed up things a bit, however it can not be considered good style, does reduce readability and often violates the DRY (don’t repeat yourself) principle.
4) Compressing JavaScript code for use in production environments is a very good idea. I do recommend to use the YUI compressor, which does not break code and works very well with additional gzip compression. It can be integrated in automated build scripts very nicely.
5) The biggest impact for a clean architecture and less memory leaks probably comes from using Event Delegation, which was not mentioned in the article. Try JavaScriptMVC.
This is how much money I spent each month for Starbucks coffee… other than expected, it’s more in summer and less in winter:

Just got my beta account for putpat.tv approved after just 52 minutes. Yes, this site is cool. It plays all your favourite music videos, just like M-TV or Viva did a couple of years ago, but based on what YOU like (last.fm integration *yeah*) and without ads for mobile phone ring tones. The only bug I found so far, is that the default gender is female – an empty field would be less confusing maybe. Also a fast internet connection is required probably. My 32 MBit line does not make any trouble of course.
Some newspaper wrote that putpat is the next revolution after youtube. Might well be, after what I’ve seen. Basically people go to youtube and click one video after another. Putput selects the right videos for you and there’s no interruption between the clips. Very convenient
See for yourself!
A new stable release of the JavaScriptMVC framework was released yesterday
Justin Meyer developed it, while working with us on a new Web application. Some features like the new custom events are direct results of this project. He did an excellent job!
New features include: