Building Rich User Experiences w/o JavaScript Spaghetti

Most Javascript is written to glue code and UI together without any thought to design patterns. Over time this leads to piles of Javascript that look nothing like code you’d be proud of writing. In this talk we’ll look at the rise of software libraries (like Knockout) that can help add structure to your JS. We’ll talk about when they help your project, and when they get in the way. We’ll also look into how you can easily use the Mediator pattern in JavaScript to really clean up your code with or without other libraries.

6.
The Problem Designers tend to think in terms of appearance. Good ones think about usability. Only the very best ones think about programmability. Developers make it worse by not thinking about designSaturday, March 17, 12

45.
Mediator Pattern "The essence of the Mediator Pattern is to "Deﬁne an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently." -Design Patterns: Elements of Reusable Object-Oriented SoftwareSaturday, March 17, 12

46.
NavControlMediator itemSelected() unselectAll() Events from some other objectSaturday, March 17, 12

47.
Observer Pattern "Deﬁne a one-to-many dependency between objects so that when one object changes state, all its dependents are notiﬁed and updated automatically." -Design Patterns: Elements of Reusable Object-Oriented Software Think jQuery $(‘.something’).click()Saturday, March 17, 12

48.
NavControlMediator itemSelected() viewModel unselectAll() Events from some other objectSaturday, March 17, 12

52.
Service Bus A service bus is another layer that sits outside controls. Controls that want to communicate speak through it. Your controls are then only coupled to a single thing.Saturday, March 17, 12

54.
Service Bus + Mediator • Controls no longer need to know about others. • We can remove/replace controls individually. • We can add controls that listen to the same events without modifying the publisher. • We can re-use pieces more easily because they work in a standard way.Saturday, March 17, 12