Illustrated WPF and WPF Programmer’s Reference

I am studying for my MCPD exams, which I am taking in 2 weeks.  Because the official exam guide is so horrible, I picked up a couple more more books.  The first is Illustrated WPF by Solis.  I made it through page 141 before giving up.  I then opened WPF Programmer’s Reference by Stephens.  I made it through page 178.  Both books suffer from the same problem – they don’t teach WPF.  Rather, they introduce all of the concepts of WPF in a subject-specific way.  For example in Solis, Chapter 5 Layout, then Panels, then the StackPanel, then the wrapPanel, etc…  Each section has an illustration or two with a basic code snippet that you can read.  The problem is that I (and most people) don’t learn computer languages like this – it is equivalent to reading MSDN cover to cover.  I draw on my experience from Ivor Horton’s Beginning C++ or Doug Wright’s Beginning VB6.  Those books were more tutorial based with exercises to encourage the reader to have his/her hands on the keyboard.

 

I have one more book WPF4 Unleashed by Nathan.  I am not optimistic.  I’ll give the book a creditable try but I am already thinking about an application I can write to teach myself the concepts.  I hope I can get it done by my self-imposed exam deadline.

Advertisements

Windows Applications Development with Microsoft .NET Framework 4

I am prepping for my first .NET 4.0 upgrade exam (70-521) that I want to take in a couple of weeks.  I purchased the Microsoft “official” training kit and worked my way though it over the last 7 days.  In a word – “terrible”.  In two words – “really terrible”.  In three words – well, you get the idea.  Why do I think this book is a waste of time?

  • There are little, if any, code samples to explain a concept
  • The material is not cumulative, nor is there a unifying application/project to tie concepts together
  • The actual explanations are overly wordy and opaque
  • The code samples, when they exist, are examples of anti-practices.  Consider this nugget from the first chapter:
  • foreach(FontFamily F in Fonts.SystemFontFamilies) { ListBoxItem l = new ListBoxItem(); l.Content = F.ToString(); l.FontFamily = F; listBox1.Items.Add(l); }

(Yup, this was written by someone who considers themselves a professional programmer)

  • The book’s size is due to listing each enumeration value in chart form – basically unreadable.
  • The pictures are in black and white
  • Each chapter ends with helpful “exercises” like “Build a calculator program” or “Practice creating resources” without any guidance on how to do the task or any final answer to check against.

I ordered some other WPF books that were recommended – I’ll spin through them in the coming weeks.  Until then, I am just puttering around with WPF – which is my new BFF (sorry WF)….

The Var Keyword

Consider the following block of code:

using (NorthwindEntities entities = new NorthwindEntities()) { var x = from y in entities.Categories select y; }

The Var keyword resolves at run-time, meaning that its value depends on the right hand side of the equation.  If I chain a function on the right hand side like this, var takes on a different meaning:

using (NorthwindEntities entities = new NorthwindEntities()) { var x = (from y in entities.Categories select y).First(); }

I see that var is used extensively, so I guess I am in the minority but I don’t like to use it.  I am willing to trade off some verbosity for clarity of intention.  If I use the var keyword, I need to read the right hand side of the equation first to figure out what goes in it (and hope that I guessed correctly – with some of the convoluted LINQ that I have seen written, no small task).  Since I read left to right, it waste time and my CPU cycles.  In addition, I fail to see what is wrong with being more explicit in the left hand side of your equation:

using (NorthwindEntities entities = new NorthwindEntities()) { IQueryable<Category> catagotyQuery = from catagories in entities.Categories select catagories; }

In this example, my intention is clear and I have much more readable and maintainable code.

.NET 4.0 Upgrade Exams–> Here I Go Again….

I have started studying for my .NET 4,0 upgrade exams: Exam 70-521 and Exam 70-523.  I read the subjects covered on the Microsoft exam website and it is obvious that they are covering more of the >NET 3.0, 3.5, and 4.0 framework than before.  For example, there is much more of an emphasis on LINQ and WPF than the 3.5 upgrade exam.

Diving into LINQ, I realized there is TONS I don’t know about –> SelectMany, Joining Tables, etc… As for WPF, I am coming up to speed on the basic syntax –> like what is the difference between a TextBox and a TextBlock.  The exam guides should be coming in the next couple of days.  Between that and the on-line Microsoft resources, I should be ready.