3 Silverlight Architecture Tips with Brad Himelstein

Recently, I dove back into XAML-based development to create some Silverlight plugins for a large web application. Most of my experience in XAML came from writing a WPF application from 2008 to 2009, so I had much to learn about the asynchronous data retrieval paradigm used in Silverlight. I had questions about UI Design Patterns, Service-Oriented Architecture (SOA), and how to reuse class libraries, so I asked Brad Himelstein, from CinCom, if I could pick his brain while we hit a few golf balls. Brad has continued working with Silverlight and WPF for a few years, since we worked together on the aforementioned WPF application.

Below is a summary of his tips as well as some quotes from our conversation.

 

Tip #1: Use Model View ViewModel (MVVM)

Me: “Do you ever use any sort of patterns for the UI?”

Brad: “MVVM

Me: “I am just now getting introduced to that. What are the benefits?”

Brad: “It is great, because you just setup the data context and do all your databinding, and it just magically works. Two-way binding works as well.”

 

Brad identified additional benefits during other parts of the conversation. MVVM’s primary purpose is to separate the concern of the behavior of an application from that of the user-interface design. It is a practical implementation that is cleaner to understand and easier to pass back and forth between designers and developers versus the default approach of placing logic in code-behind files. He provides sample MVVM source code here.

 

Tip #2 Extend Proxy Classes with Shared Custom Code

In my application, I use WCF RIA Services to query server objects and return them to the Silverlight client. This technique simplifies the process of retrieving service data and populating local objects because a local proxy object is created and populated automatically. In Brad’s words, “If the web service returns an object of class ‘Foo’, we don’t need to redefine ‘Foo’ in the Silverlight app.”

Unfortunately, I had a great deal of logic included with the retrieved classes that I also wanted to be able to use in the client. I asked Brad how to elegantly work around this limitation of Service-Oriented Architecture.

Me: “What I was hoping to get with RIA Services was, say I’ve got some class I’m returning from the service. I can load it with data easily but I have additional calculation properties on this class, such as FullName, which is just a property that returns FirstName and LastName concatenated. A local proxy object is created automatically for use in Silverlight, with data populated for FirstName and LastName, but the proxy does not retain calculation logic. Since I have a server-side object that has calculation properties defined, how can I share that code for use with the Silverlight client and the proxy object?”

Brad: “If you know you’re going to use FullName, then just create another string called FullName and set the property on the server so it is passed down to the client in the object, because it is not going to take those calculated properties and bring them down.”

Me: “But then that FullName would have a state when it returns.”

Brad: “Remember, you can extend everything. So on the client side, you can alternatively have your own Foo class, which can be used to extend the partial Foo class that is returned from the server.”

Brad’s suggestion was enough to help me come to a solution that fit my needs.

 

Partial Class Extensions

Let’s use the sample Class “User” to continue our example from above. In such a class, I can place fields of the User, such as FirstName and LastName in one file named User.cs. User class should be defined as a partial class, so we can combine definitions of the class from 2 separate files. Hence, in another file, named UserCalcs.cs, we should define calculated properties, such as FullName. At this point, the server behavior will work as it always would have if we had just implemented all properties and fields in the one file. However, the Silverlight client would not yet know about the FullName property.

 

Shared Files

An important limitation of Silverlight is that it can only reference projects that are compiled as Silverlight projects. In other words, Silverlight cannot natively reuse definitions from standard .NET class libraries. What it can do is recompile normal .cs files into a Silverlight assembly.

To do this, right-click on the Silverlight project in your Visual Studio solution and click Add Existing Item. Navigate to the file that contains the calculated properties, UserCalcs.cs. Click the file, and then click the down arrow next to the Add button. Choose Add As Link.

The Silverlight project will now compile this partial class definition. It will extend the proxy class as well as the server side class from the same file. Therefore, maintenance of those calculated properties can be shared between the client and the server side code from one file.

 

Tip #3 Learn HTML 5

Ok, Brad didn’t actually say this so bluntly, but it was a recurring theme of our discussion. Based on recent information about upcoming Windows (8) releases, Silverlight’s future is unclear. From what I have heard, Microsoft is committed to version 5 of Silverlight (current release is 4) but has made no guarantees beyond that. Windows 8 will have 2 versions of its Internet Explorer 10 browser: tablet and desktop. The tablet version will not allow plugins, like Flash and Silverlight. Some have summarized the decision by stating that from Microsoft’s standpoint, Silverlight is “no longer strategic.”

Still, the death of Silverlight development, especially in corporate environments, is distant. Here is a great Microsoft client decision workflow about the correct technology to leverage based on your needs. I believe it reinforces the idea that even after Windows 8 is released, new Silverlight applications will have their place.

Lastly, even though Windows 8 tablets will not allow Silverlight plugins to be loaded within its browsers, native Windows 8 tablet apps will be developed using WinRT. As Brad informs us, this gives us Silverlight developers hope, as WinRT is still “just C# and XAML.”

 

By

Were my Microsoft Certification Exams Worth it?

As important as it is for Software Developers to keep current with emerging technologies, it is equally important to choose wisely when it comes to learning them. Indeed, there is a finite amount of time to devote to self-improvement. This truth became evident most recently while I’ve been thinking about my personal goals for the year and trying to decide whether or not I should try to obtain the more recent Microsoft certifications on .NET 4.0, such as Web Developer or Azure Developer on Visual Studio 2010. It got me to thinking about all the time I spent at the beginning of my career getting certified and whether or not that investment has paid dividends.

As described in Contrasting 2 Job Rejections, I was scared about my job prospects after graduating college. Once I got a job, I felt that I needed to ensure I had opportunities going forward and figured getting Microsoft Certifications would be the best way to differentiate myself from the candidate pool. I took 14 tests in less than 3 years, passing 12 and failing twice. I obtained the status Microsoft Certified Systems Engineer (MCSE), Microsoft Certified Database Administrator (MCDBA), and Microsoft Certified Solution Developer (MCSD). You can see my transcript here (enter transcript ID “677424″ and access code “insights”).

Some of the tests were paid for by my employer, some were not. I usually studied using the officially released self-paced training kit for each test, but I’ve also purchased expensive training videos, exam crams, used free web casts, etc. I was completely immersed in the certification process. I actually understood all the options and the Microsoft certification path, of which there are now many. Since it’s been almost 2 years since I’ve taken any, I find myself out of the loop, wondering if it makes sense for me to re-enter this world.

At the time of this writing, I have about 7 years of professional software development experience, enough to significantly reduce the amount of studying required to pass a certification test compared to earlier in my career.

Microsoft
Certifications
Expected Study time (hours) Completed Study Time (hours) Practice Tests (hours) Days Studying Hours Per Day Test Date
70-270 (Microsoft
Windows XP Professional)
45 51.00 9.50 35 1.73 February 12,2004
70-290 (Windows Server
2003 Environment)
31 28.00 3 23 1.35 March 10, 2004
70-291 (Windows 2003
Network Infrastructure)
47.5 78.00 11.5 122 0.73 July 9, 2004
Took Test on July 9th 9 4.5 12 1.13 July 21, 2004
70-293 (Windows 2003
Planning a Network)
22 12 4 15 1.07 August 5, 2004
Took Test on August 5th 30.50 8.5 64 0.61 October 8, 2004
70-294 (Windows Server
2003 Active Directory)
21 14.08 4 31 0.58 April 2, 2005
70-297 (Win2003 A.D.
& Network Infastructure)
16.5 16.92 2.5 17 1.14 April 19, 2005
70-228 (SQL 2000
Administration)
55 53.42 5.5 72 0.82 May 27, 2005
70-229 (SQL 2000
Development)
24 23.50 3 151 0.18 October 29, 2005
70-315 (Web Apps with
Visual C# .NET)
34 45.50 13.5 81 0.73 January 24, 2006
70-320 (XML Web Services
with C# .NET)
40 34.00 3 42 0.88 May 2, 2006
70-316 (Windows Apps
with Visual C# .NET)
14 15.42 3.25 22 0.85 June 6, 2006
70-300 (Solutions
Architecture & Req’ts)
12 7.58 9 47 0.35 September 28, 2006
70-553 (Upgrade MCSD to
MCPD : Part 1)
82 16.00 4 428 0.05 April 12, 2008
70-554 (Upgrade MCSD to
MCPD : Part 2)
55 0.00 5 22 0.23 May 5, 2008
Took Test on May 5th     still counting 0.00 February 28, 2009?
70-502 (.NET 3.5 -
Windows Presentation Foundation)
14 14.00 6 108 0.19 December 13, 2008
70-561 (.NET 3.5 -
ADO.NET)
12.25 12.50 0.5 18 0.72 May 2, 2009

Would obtaining more certifications be valuable? Looking back, I feel that it was worth it to work towards achieving the certifications that I did. They served 2 purposes:

Milestones for Self-Motivated Learning

By deciding to get certified, I was declaring a personal goal that was tangible and had benefits other than just self-improvement. Many of the topics involved in certification were topics that I wanted to learn about anyway, especially early in my career. For example, I was assigned to my first professional web application project about the same time that I was ready to begin studying for the related certification. Since my professional life and personal interests were colliding, I found it much easier to be motivated to study and create small side projects to practice what I had learned. Better yet, knowing the milestone of passing the test would aid in job security added to the incentive to learn.

Measurable Proficiency

I have heard people in the IT industry downplay the significance of certifications, especially those from Microsoft. Some have argued that the tested topics do not accurately reflect skills that are required to perform well on the job. Others state that the proliferation of “brain dumps,” practice tests that have actual questions from real exams (and are considered cheating), marginalize what the tests represent.

My feeling is that there is a lot of truth to these points. However, employers still seemed to have placed some value on certifications. They may have asked, “If certification tests are so trivial, why doesn’t everyone have them?” I found in the years after my achievements, that it did help in my job search. I believe it exhibited measurable proficiency in topics that I claimed to have experience in. This differentiated me from others who could merely state something to the effect of: “Experience = ASP.NET – 2 years.” The achievement generated conversation in interviews. When asked about my certifications, I got to explain how I set personal goals and followed through on them, learning a great deal of relevant skills in the process. @MikeWo also reminded me on twitter that companies need certain certification requirements of their employees to keep partner status, yet another benefit to hiring someone who has them already or displays the ability to pass them quickly.

 

Having established that it was worthwhile to get certified in the past, does that mean I should set a goal for future certifications?

 

It is yet to be determined, but I don’t think so. The direction I am trying to take with my career is not to spend focused time learning the details of the next version of ASP.NET, for example. I have also already built my resume to a point where “getting my foot in the door” is not the problem it used to be. Therefore, the benefits listed above do not quite align with what I want to achieve going forward. I could always afford to learn more about Microsoft technologies, such as .NET, but I already know enough to be effective. I am more interested in learning non-Microsoft technologies these days, like jQuery, Mercurial, or anything Google, so I may be convinced to take a test for a new, interesting technology once it is released and known to have value throughout the industry. Lastly, I believe that the best way to get a great job is a great network and by establishing the ability to get things done.

 

Time to buckle down and get things done then…

 

Exam Tip: No matter how much you study before-hand, always cram: it’s important to have that info in short-term memory going into the test.

Mind Map Software – a Great Tool for Brainstorming

Are you struggling to be creative? Looking for ways to organize your brainstorming sessions? Or maybe you’re just bored? I have found a good solution for when I am stuck in one of these situations. I look to Mind Map Software for help.

What is Mind-Mapping Software? It is software that helps you to keep track of related thoughts on a bubble-laden canvas. It produces a similar drawing to what you would have put on the chalkboard in 5th grade. Remember that? When no idea was a bad idea?

 

The nice thing about good Mind Mapping-Software is that it speeds up the rate at which we can record information while brainstorming. I type faster than I write so if I can brainstorm digitally, then I am less likely to forget a key idea I had before recording it. Additionally, soft-copies are more easily stored (than 50 white-boards) and can be updated later.

I have used a few of these applications and have definitely found them useful but I would like to do it more. I am just looking for the perfect option at a good price. Below are a couple neat options:

Installed Applications

Mind Manager – I understand this to be one of the leaders in the market, and at $349 it better be robust. I downloaded a trial and was impressed with the software. It had many templates for creating different types of documents, like organization charts and process flow charts. It was also very easy to add new nodes (spacebar) and new child nodes (insert), which is my most important feature.

Using Mind Manager reminded me that these Mind Mapping Software applications are also great for capturing flow charts. During times when you are trying to explain how a process works or how different things interact, fire up the software and draft a quick mind map diagram. Sure, you could use Microsoft Visio to do it but since you’re getting familiar with your Mind Mapping tool you might as well use that.

FreeMind – This is the other leader. It is open-source and free. The interface for this application is not nearly as beautiful as that of Mind Manager, but for technically-savvy folks like us, it is just what we need. FreeMind also suggests some other interesting uses for their product here, such as for a task list or meeting notes. I would choose FreeMind if I were going to install a windows application, but that’s not what I really want…

iPhone Applications

It would be extremely helpful to be able to record brainstorming sessions on my mobile platform (iPhone). Usually, when I am sitting in front of my computer, my head is buried in my work, writing code, blog posts, or email messages. I struggle to take a step back and reflect while sitting at my desk, because I tend to act on the first idea I have with my computer so close and accessible. The best broad thoughts I have seem to arise when I am not distracted by my computer: waiting to board a plane, riding a bus, or running on a treadmill. I’d like to capture those thoughts as seamlessly as possible.

iBlueSky – I am still searching for the perfect iPhone Mind Mapping application and this is not it. It is $9.99, seems limited, and only has a 3.5 star rating in the App Store. It is amongst the leaders of iPhone Mind Mapping applications but I think I will pass on it.

iThoughts – I am definitely going to give this a try. It is $7.99 and looks very intuitive. It has a 4 star rating in the App Store. I am excited to use this with my Bluetooth iPhone keyboard.

Google Wonder Wheel

Google Wonder Wheel is in a class of its own. It’s useful and yet many people do not even know it exists. To use, search for a topic in Google around which you are trying to brainstorm. How about “Mind Map iPhone Applications?” The lowest option on the left menu should be “More search tools.” Click that. Then click “Wonder wheel.”

I could not describe this tool any better than GoogleWonderWheel.com:

“Did you say mind mapper? This tool is a built in mind mapper with the intention to sort out search results in a logical way of relevancy creating a visual wheel of terms that can make your searching enjoyable and time effective at the same time.”

Clicking around the wonder wheel reveals related topics to what was originally searched for. It’s how I generated the chalkboard image above. I recommend playing around with it as you never know what it might help you to find.

Which Platform is the Best for My Mobile App?

I am currently sitting at the Cincinnati Microsoft office attending the CINNUG Mobile Development FireStarter. This free training session covers how to create mobile applications for Android, iPhone, and Windows Mobile phones. I do not have any immediate plans to create a mobile application soon, so what am I hoping to get out of this session?

3 Highlights I Want to Learn Today about Mobile App Platforms:

  • Pros & Cons of different platforms
  • Enough knowledge to be able to manage an outsourced app developer
  • Insight as to which platform is emerging as the leader

Throughout my career, I have been heavily focused on Microsoft development technologies. Often times recently, I have wondered if I should branch out to other languages and platforms. I have not yet done this, but if I were to move into mobile development (something I have limited experience with so far), it would be an ideal time to jump on the best platform as opposed to using Microsoft without questioning the decision. Therefore, I am happy to take advantage of this training session and glad that the format will discuss 3 different platforms.

What Did I Learn?

The training is over and I have formed some conclusions while generating even more questions. Below are summaries of what I learned.

Pros & Cons of Different Platforms

If I want to sell a mobile application then I need to make a good decision for which platform to build it. Each platform has its own benefits so it is possible that each platform could be best for certain types of applications. Below are the high-level Pros and Cons for each platform:

Android

Android Nexus One

Photo by Spieri_SF
    Pro

    Quickly gaining popularity

    Open source    

    Con

    Uses Java

    Somewhat limited for game development

iPhone

iPhone Image

Photo by William Hook
    Pro

    Most Popular

    Same OS for iPhone, iPod Touch & iPad

    Con

    Development requires a Mac

    Uses Objective C

    Only distributable through the app store

Windows Mobile/Windows Phone

iPhone Image

Photo by Brooks Elliott
    Pro

    Familiar tools and language

    Mature – platform has existed for a while

    Con

    No physical devices for new platform version (7)

    Adoption is a downward trend

 

Enough Knowledge to Be Able to Manage an Outsourced App Developer

Realistically, I am not going to drop all my plans or projects to dive in and write an iPhone application. I have enough wisdom to know that would probably be a waste of time unless I really want to learn iPhone development or if I had a great idea for an app for which I knew there was a market. Therefore, I don’t need to know at this time how to develop a mobile application. I just need to understand the highlights.

I am trying to prepare for the moment when I have that great idea for a mobile application. When that happens, I don’t want to be clueless about the next steps involved. I want to have a good idea for limitations of current platforms, which technologies are emerging, and how to move forward getting the thing developed.

Ideally, I will someday “own” a mobile application. When the time comes, my plan is to hire someone to build it, but I do not want to be ignorant to what is involved. By seeing these demos, I have been introduced to developing mobile applications. If I want to learn the details, I know where to start. If I want to hire someone else to develop a mobile app, I can now intelligently discuss the project and properly vet the person’s credentials.

 

Insight as to Which Platform is Emerging as the Leader

Perhaps the most important aspect to deciding which platform to develop for is how popular it is. Simply put, the bigger the market that my application can reach, the more sales leads that can be generated. So which platform will the most users be running when my application is finished and ready to be sold?

At the time of this writing, the iPhone is the most popular of these 3 devices. 2nd is Windows Mobile, with Android placing 3rd.

Most importantly, iPhone users consume the most network bandwidth out of all smart phone users. I believe this is a testament to the high user engagement with iPhones and consider this a forecast of its future growth. Some industry experts have opined that Google’s Android platform will emerge as the leader given its “open” paradigm is more beneficial to developers. Still Microsoft’s upcoming release of Windows 7 Phones may tip the market share into their favor.

I am by no means an expert, but my bet would be that the iPhone will be the dominant smart phone platform for the next few years. The barrier to entry for users is low and it already has a head start influencing the industry. Everyone that has an iPhone loves it and everyone who doesn’t have one wants one. I don’t know a single person who is excited for any Windows Phone news and only a few who are aware of Android’s developments.

If Apple ever allows the iPhone to be used with wireless networks in addition to AT&T, such as Verizon, look out! They will have removed the biggest barrier left to everyone wanting one.

Which mobile platform do you see emerging? Which platform would you recommend? Your opinion is probably more informed than mine.

Follow

Get every new post delivered to your Inbox.