22. May 2009, 14:09, by Leo Büttiker

From the for loop to the generator in JavaScript

I recently spent some time writing JavaScript code and do reviews of JavaScript features. JavaScript has some nice language features that make it easy to write short and readable code. (On the other hand it is also quite easy to write horrible code with it.) In this article I try to show you how you can refactor your code to something more readable.

We may start with this non-fictional example:

/**
* Returns array of uids of selected items
*/
getSelected:function() {
	var returnArray = new Array();
	var modelFriendListItems = this.modelFriendListItems.getSelected();

	for (var index = 0 ; index < modelFriendListItems.length ; ++index) {
		if(!modelFriendListItems[index].isFacebookUser)
			returnArray.push(modelFriendListItems[index].id);
	}

	return returnArray;
},

It’s just one function out of a class that does quite something typical. This function goes over a list of items (iterate) and builds an array out of some of this items (filter). A friend of mine does some ruby coding and in ruby this would look something like this:

this.modelFriendListItems.getSelected().select{|item| !item.isFacebookUser}.collect {|item| item[:id]}

This is quite short and still yet readable. In JavaScript you can go as well in the direction of more functional programming. So let us refactor the JavaScript example above over some iterations. The following examples use prototype.js because this framework extends the JavaScript array with some fancy functions.
(more…)

Filed under: PHP, Programming
18. May 2009, 19:39, by Silvan Mühlemann

20 Notizen zum Silicon Valley

Because I did not plan to post this article in this blog, it is in German. This should be an exception. Sorry for the English readers.

Die letzte Woche habe ich im Silicon Valley verbracht. Mit einer Gruppe von 12 Leuten haben wir verschiedene Firmen und Organisationen besucht. Hier zähle ich ein paar wild zusammengewürfelte persönliche Eindrücke auf:

  1. Die zwei heissesten Themen in US-Firmen sind Cloud Computing und Green IT.
  2. Trotz Green IT ist die durchschnittliche Temperatur im Sitzungszimmer nie höher als 18°. Warme Kleidung ist empfohlen.
  3. Je niedriger die Temperatur im Sitzungszimmer, desto grösser das Unternehmen.
  4. Die NASA arbeitet mit Original-Anlagen aus den 50er-Jahren. Gut amortisiert!
    Von Silicon Valley Tour 2009
  5. Google ist jene Firma, welche am häufigsten unsere Fragen mit “I cannot comment on that” beantwortet hat.
  6. (more…)

Filed under: Web Development
23. April 2009, 10:34, by Riv-Alain Vakili

Website performance optimization: Don’t forget the client-side!

Regarding the topic “optimizing page-loading-times” too many people still set the focus only on the server-side, ignoring the fact that most of the loading time is spent getting all the components of the page(CSS, JavaScript, images, ads).
The yahoo performance-team proved this very well.

Also, pages (like tilllate.com) more often make heavy use of JavaScript with the goal of providing a better user experience. The problem is, that most developers work on modern hardware and develop on their favourite web browser – which is usually a recent one. They forget that a big amount of visitors still surf with their first computer bought 7 years ago at Interdiscount and is mostly surfing on the developers least favourite browser (like IE 6). As a result, those visitors often do not get the optimal user-experience and the website loses traffic (=money).

(more…)

Filed under: PHP, Programming, Web Development
31. March 2009, 21:41, by Silvan Mühlemann

Job opening: Web developer (PHP / AJAX)

Are you enthusiastic about web technologies? Do you have strong PHP, Javascript and SQL skills? Would you like to work with a team of smart and passionate people? Are you open to advanced development methodologies like Scrum or Test Driven Development? Would you like help further develop one of the biggest Swiss website?

Then you should apply for a job at tilllate.com: Our team is looking for dedicated web developers. You’ll find more information in our job ad:

Filed under: Arbeit, PHP, Web Development
17. March 2009, 23:33, by Silvan Mühlemann

Scrum: How we do Sprint Retrospectives

Four weeks have passed since the last sprint planning meeting. Sprint number two has come to an end. It’s time for the sprint retrospective.

The motivation for the sprint retrospective is:

  • Visualize the accomplishment - important for the team morale
  • Review any impediments and discuss measures on how to avoid them in the next sprint

Here’s how we are structuring the sprint retrospecives:

The set up

The team and the product owner are allocating one hour in the meeting room. We’re looking at the wall with the task board showing the user stories, the burn down chart and the impediment backlog. This is a big paper with a post it for every impediment encountered during the sprint. We collected the impediments during the bi-weekly scrum meetings (aka daily scrum).

Visualize the achievements

First, I go through all done user stories and say a few words about every story. Time for praising the team. Developers often think “we haven’t achieved anything”. So it’s important to visualize the finished user stories.

(more…)

1. March 2009, 13:43, by Silvan Mühlemann

MVC for Javascript Controls

I recently had to take over an unfinished project. It was an AJAX control to select multiple friends as you can find it on Facebook.

friendselector_facebook

“It’s 99% complete”, I was told. Yeah, right. I counted 2 story points (without looking at the code). Soon I knew I was too optimistic: Classes calling other classes without logic. Randomly named variables. Data, creation of DOM elements, AJAX calls spread all over the place:

Architecture before refactoring (dramatized)

Architecture before refactoring (dramatized)

That’s not going to be easy. To make things worse: I am a Javascript beginner. What I did up to now was procedural Javascript code.

(more…)

Filed under: Web Development
16. February 2009, 23:14, by Silvan Mühlemann

Implementing scrum at tilllate.com

The first sprint is done! Yes we finally started doing Scrum at tilllate.com*. Well, it’s not exactly how Schwaber and Sutherland would expect it. But our way fits our team. And the acceptance in both the IT team and the rest of the organization is high. It improves motivation and therewith the performance of the team. And that’s what matters.

Sprint planning meeting

Sprint planning meeting

(more…)

14. November 2008, 16:57, by Leo Büttiker

Clientside Cache Control

Users hate your cache

Users don’t like caching! They want to see the changes immediately. Otherwise they get confused and write you bug tickets or flame mails. But if you do not use caching the user comes and make your CPU’s burning. If your site is down you not only get mails from your users, but also from your management.

We worked hard on the right caching strategy over months now. But there are still caches that do not get invalidated right or are cached too long and we still get complaints from our users. So we decided to integrate a feature that allows certain users to invalidate the cache on the server side. The first idea was to add a link to every page that will append a GET-parameter to the site and then avoid the cache.
(more…)

Filed under: PHP, Programming
29. August 2008, 16:55, by Steven Varco

Johnny Project: Filers arrived

The new filers for our Johnny Project* had just arrived and since our business has “quite a lot” to do with photos, I decided to do a little “unboxing fotostory” again. ;-)

The specs of these machines (per machine):

  • transtec CALEO 3U
  • Quad-Core XEON E5405, 2.0 GHz
  • 14 Seagate 1TB SATA-2 Disks, 7200 rpm
  • 2 Seagate 146 GB SAS Disk, 15′000 rpm

The three filers cleanly piled up, but still in the box

So, lets open the box!

Of course we all were excited about the inner values of those filers too, so we got them “prepared for surgery” (luckily we didn’t have to use a scalpel for that ;-) )

Some close-ups

As we can see, there would be “a little bit” of space for RAM extension… ;-)

View from the back…

…and from the front. -Looks cute indeed! ;-)

But whats even better than one server full of disks…?

Right, THREE SERVERS FULL OF DISKS! ;-)
Total Capacity: ~38 TB

The whole environment for our Johnny-Project in the lab.
Left: The Mogile Storage Nodes, Right: The Old new ASUS cache servers

*if you may wonder what’s that mysterious “Johnny Project” im talking about, stay tuned for further blog posts! -We will describe this at a later time. ;-)

14. August 2008, 16:45, by Steven Varco

Our new Mailserver

In the beginning of this year, we’ve decided to replace our old mail server, which was pretty at the end of its capacities, dealing with as “little” as 50′000 new mails (sent & received) DAILY for our 1500 mail users.
With also about 800′000 single mails stored, the old mail server ran out of disk space; we surely needed A LOT of disk space and even room for storage expansions.
(more…)

Filed under: Arbeit, IT Infrastructure
Next Page »

© 2009 tilllate Schweiz AG - Powered by WordPress