I’ve had the pleasure of getting early hands on for the MCTS certification guide for Silverlight 4, and figured I’d do a short review of it.
The purpose of the book is to give you a guide of what to expect to know for becoming a certified Silverlight developer. Personally I haven’t done the certification, so I won’t be able to say if it is sufficient or not, but I would imagine that the certification itself has been used as a guide for what is needed.
Silverlight 4 is a pretty large subject on its own, and quite ambitious to cover in just one book and at the same time provide guidance towards a certification. I feel that this book really accomplished this in a good manner, it is straight to the point but at the same time not leaving out any explanations. I even picked up some basic knowledge I was not aware of myself.
Being a guidance for certification, it does just that, so its not going to go outside of that promise. Which probably makes it feel a little light-weight on real world scenarios and it stays true to the original Microsoft messaging. It mentioned MVVM to some extent, but it could probably have dove into that subject a bit more, in my opinion. But I totally understand why it is not brought up. Being very focused on code quality, testability and such I feel that it is important to get this message straight, even though it might not be 100% relevant to a certification.
All in all I found the book to be as close to a page turner as these kind of books can be, I learned some basics myself and brushed up on my own knowledge of Silverlight while reading it. And I’m pretty confident it will serve as a good guide for a developer wanting to certify him/her-self as a Silverlight developer.
If you’re looking to become an MCTS certified Silverlight developer, you might want to do so through the guidance of a certification guide. Packt Publishing has a book by Johnny Tordgeman, to do just that. You can go get it here.
About the book The book will take the readers through the process of laying out a user interface in Silverlight using concepts such as panels, content controllers and navigation. Readers will also learn the configuration, delivery and deployment of a Silverlight application and dynamically loading resources into the application, working and creating a powerful data driven line of business application. Also you’ll learn to understand how to enhance the UI of your application through manipulating visual elements, creating animations and other important UI concepts.
The book is written by Johnny Tordgeman, a professional SharePoint, FAST and frontend developer and trainer.
There is a contest The cool part is; Packt is sponsoring a contest, right here – on this blog; two e-book copies to be given away to two lucky winners.
How can I win? All you have to do is drop a comment below highlighting why you should win this book. Don’t forget to post how we can hold of you; a twitter alias, obfuscated mail address or similar.
Duration The contest will be valid for 7 days from this post – meaning that you’ll have to post a comment with a good description by July 29th.
Selection of winners Winners will be selected on the basis of their comment posted.
From a fronted development perspective, Bifrost is taking on this latter part. Traditionally one would compose the resulting web page that is handed over to the client on the server. Multiple solutions exist out there for doing so, and specifically in the .net space, ASP.net and its derivatives are the most popular ones. Rendering, as this is often referred to, adds an extra load onto the server – not only is the server responsible for dealing with the request from the user, wether it is getting data or performing an action, but it also has to transform the result into something the client can show. On top of all this, it has to deal with security. This pattern is a very proven pattern, but in my opinion not the pattern we want to be doing moving forward, and therefor Bifrost will focus on a different pattern. Sure, Bifrost will not only be compatible, but also support out of the box the traditional route – but for now in an opinionated fashion by only supporting ASP.net MVC. The technique that Bifrost will be focusing in on is the Single Page Applications, were you basically hand over the “rendering” to the client and let the client compose the page by swapping in and out elements at runtime. This is in fact nothing new, ever since AJAX became the big thing, we’ve pretty much been doing this – but only for parts at a time and even letting parts of our page be swapped out for new versions being rendered by the server dynamically.
Bifrost will have a composition technique that is based on, as most things in the framework, conventions. The focus will be on Features and one can point to a feature simply by adding a <div/> tag and give it the attribute data-feature=”[name of feature]”. Based on the configurable convention, Bifrost will find the necessary files representing the feature. Looking at the page from Geekrider as it is at the time of writing this post, we’ll have the following.
Summarizing, Geekrider will be the proof of concept for features added to Balder and Bifrost – driving forward with new thoughts and ideas. I will try to blog about the progress as much as my schedule can permit. This means I should keep myself from playing around or doing unnecessary stuff.
In 2007 I started something called Balder, a 3D engine for the Web using Silverlight. Back then with Silverlight 1.1 Alpha and later 2.0, there really weren’t that many options to make it especially feature rich, nor fast. My first goal when I started this whole thing was basically to achieve 3D rendering on the Web across multiple platforms (Windows + Mac, later Moonlight on Linux) and have a declarative programming model for 3D. This is still the motivation for Balder; to be cross-platform on the Web and be declarative in its nature. I’ve never had the idea of being a 3D engine to compete with the big engines out there that are both free and commercial, this has been partly a research project for me to learn Silverlight properly from the ground up and also maintain a foot within the graphics programming industry which I still hold dear. Even though my day to day job is something completely different these days, I’ve always had side projects that kept me somewhat close to what was happening in the games industry that I left behind some 10 years ago.
Back in 2007 with SL1.1 and 2.0, you basically had to either built on top of the built in primitives, which were super slow or you had to do magic like create yourself a realtime PNG encoder and draw pixels manually with code and then hand over the generated PNG to an Image control inside Silverlight.
With Silverlight 3 came along the WriteableBitmap that enabled to skip the PNG step and Balder started to pick up performance and features were a lot easier to create. This story continued through for Silverlight 4 and Balder has received many a make over of both its rendering pipeline, but also internal architecture while I’ve learnt more and more in-depth of how to do things in the best way inside Silverlight. With the announcement of Silverlight 5 came a long a low level interface for drawing 3D utilizing the GPU sitting inside your graphics adapter. Finally Balder could shine with great performance and still maintain its declarative, Silverlighty way of doing things.
For SL5, that was the gold-plated story – the reality is quite different. Balder needed yet another architectural make-over in order to achieve hardware rendering with Silverlight. The main problem being that rendering now had to be done on a specific rendering event that sits on a completely different thread than the regular UI thread inside Silverlight. This poses quite a few problems when Balder is built to be declarative and have all the binding capabilities that Silverlight offers.
Most of the architectural change has been done – but far from being finished. There are still some holes that needs to be filled internally in Balder that has to do with code-smell basically. At one point in time, development of Balder went forward too fast – and code-quality was during this period suppressed in favor of number of features per day that could be implemented. I know, I’m not proud, but it was the reality for the period that things needed to get done and they needed to be done fast. Another aspect of Balder development has been the lack of being able to properly test things with unit tests all the way. Quite a few times I’ve tried to do the effort to retrofit tests without succeeding all the way. Silverlight is basically too hard to test if you want to be lightweight with your tests. Sure, there are things out there that mock out the runtime and you can make most of your code so that you don’t have dependencies to the Silverlight runtime and just run the tests on the desktop framework. I’ve done all the techniques out there but never been happy with the flow. This is an ongoing things.
Are we there yet? Phew.. So, were are we at? Balder has a default branch which is still on the SL4 level where I left off over a year ago and there is a parallel branch for the SL5 parts and all the refactorings and changes that had to be done to bring Balder to SL5. There are some bugs and quirks in it and development is not going as fast as I would have hoped. There are a few reasons for that, one is the lack of tests and not a good story for retro fitting them. I’ve started doing it with MSpec and writing in a specification way instead, made it a lot easier but there is still a lot of work to be done there. The second reason things are going slow is that Microsoft has yet to come up with a good cross platform story for the 3D bits, in fact, thus far there is none – it only works on Windows for now. I’ve been probing them to get an answer, but haven’t gotten one yet. To be honest, it has for a while halted my motivation for moving forward at the same pace, until last week when I had a breakthrough in rendering that increases performance quite a bit and also the quality for software rendering, which will then prove as the fallback solution for Mac.
In addition the latest versions of the most used browsers on Mac supports WebGL, which is something that can be used directly from Silverlight as well. After getting the software rendering fallback done, I’ll start looking at the WebGL approach as a second fallback scenario for those browsers that supports it.
Another aspect of the SL5 codebase is that Microsoft changed security from the beta released at Mix to the version released at Build which lead to in-browser shaders not being allowed to do loops. Balder supported 5 light sources with the pixel shaders I wrote for the Beta version, but can only do one with the latest version of SL5. In order to fully support an arbitrary number of lights I’ll have to move over to deferred rendering and that has quite a few implications on how Balder works as well. But a job I’ve started and will make it the default rendering method across the board for now.
But all that being said, there are some critical issues that needs to be solved – they are issues that really makes it hard for me as a developer to get the velocity I want, so I will be going back and forth researching and bringing back the code quality I want to feel comfortable.
So, what about the tag-line of Balder and devices? A couple of years ago I saw the opportunity to bring Balder onto more devices and started optimizing the code-base and extension points to be able to bring to things like the Windows Phone 7, iOS, Android and others. This is something I’d still love to do, but will not focus on it for quite a while. There is still too much work on the Silverlight side to justify focusing on devices just yet. There is a version of Balder for WP 7, but not for the latest Mango and to be honest, WP7 is in fact the hardest of these devices to get any proper rendering on since one is not allowed to write shaders for that device.
Conclusion As you might understand, Balder is still active – not just at the same pace as before, hoping to pick this up a little bit moving forward. There are some code-rot that needs fixing, increase of code quality and things like that holding back development a bit, but also technical challenges with the platform. Since I’m relentless with the cross-platform part and am not willing to budge on it, I will focus my energy on getting that working and hopefully working good. If this was a commercial product, I would probably not go to the lengths I am to get the cross-platform parts working, but one has to remember that my original motivation for going down the road of creating Balder in the first place was based upon cross-platform – take that out and personally I will lose the biggest motivation I’ve had with the project.
Yesterday I released a new version of the Sample Browser for Balder – but some of the samples just didn’t work on Safari or Chrome on OSX, but worked in FireFox and Opera and all browsers on Windows (including Safari and Chrome).
Turns out there is an accuracy issue with using the System.Math.Log() method. It produces different results on OSX in Safari and Chrome when the code is compiled in release mode. When compiled in debug, it produces the correct result.
The method in Balder in question:
By casting the Log() result to float you get past the problem.
Its been a hectic week – but finally most of the pieces are falling into place for the next release. There is only a couple of minor features I want to add before calling it a release. Meanwhile, I’ve updated the samplebrowser and released it as a sneak peak. I’ve replaced the Material Picker sample with a Material Editor were you can actually edit all the properties of the materials and also the lights added to the scene.
Here’s a screenshot of how it can look like when configured with all features enabled:
If you’re having trouble with the SampleBrowser on Safari or Chrome on the Mac, this is something I’m investigating. I’ve tested it with all browsers on Windows and Mac, but these two had some issues when textures were involved on my machine. Will look into it more carefully before releasing the next version. The odd thing though, it worked with the samplebrowser compiled as debug.
Hopefully I’m not forgetting anything (probably am) – but below is a clarification of what features Balder has.
Balder uses a left-handed coordinate system – currently there is no way to change this, but there are plans for opening up for any coordinate system.
Interaction – one can enable interaction on any nodes and they can be interactively manipulated during runtime
Rotation coordinates, in angles for each axis
Hierarchical rendering of nodes
A Scene contains objects, any Balder object implementing the interface INode; Lights, geometries, sprites
Defines a clipping area on the screen, coordinate relative to its container
Field Of View
Flat image based objects that exist in 3D space – they are rendered along with other 3D content and positioned and scaled correct according to their 3D space position.
Box – simple box with dimensions
Cylinder – top and bottom dimensions can be specified independently
Ring – inner and outer circle dimensions can be specified independently
ChamferBox – simple box with a chamfer segment
HeightMap – a plane that consist of a set of vertices (points) that can be manipulated by its height
ArbitraryHeightMap – a derivative of HeightMap, but its plane is arbitrary
Mesh – a complex mesh which can be loaded from a file
Container – not renderable itself, but can contain any Node in it – hierarchically
All data loaded from disk or elsewhere is known as Assets. There are Asset loaders for file types, you can even create your own Asset loaders quite easily. For Silverlight, there exist today a limitation which only allows loading of assets found in the XAP file – meaning that any asset added to the project must be a Resource in the XAP file. This is being worked on and will in a future release be more flexible.
ASE file – supports 90% of the Autodesk Ascii Scene Export format for 3D objects
Experimental support for Demoniak3D format
JPEG, PNG for Images
Assets are cached in a content manager, which means that if you load the same asset twice, it will clone the first one.
OmniLight – non directional light, emits light in all directions
DirectionalLight – emits light in a specific direction, without any starting point or ending point
ViewLight – view dependent light that will always emit from the view and into the Scene
Z buffered rendering
Flat shaded – single color faces
Gouraud shaded – color can be specific on each corner of a triangle
I’ve been working lately on a demo that is for gaming a lot more realistic than the spinning teapot or box that one sees in the sample browser for Balder. A friend of mine Peter Rosenlund, an excellent graphics artist, gave me a 3D model of a city that I can use for that (thanks a lot!!).
In the 3D model, he had applied static lighting manually in 3DSMAX by painting the Vertex colors – a feature I had not implemented in Balder. After a few hours yesterday and this morning, I got it all up and running and I must say it looks kinda nice.
Balder, rendering city without vertex colors applied:
Balder, rendering same city with the vertex colors applied: