Archive for the ‘.NET’ Category

Book Review: ASP.NET 3.5 Application Architecture and Design

Friday, January 29th, 2010

This review is part of a series of book reviews I have agreed to do for Packt Publishing. I am not being paid for this review, although I did receive a free copy of the book. I do not work for either Packt Publishing or Microsoft.

ASP.NET 3.5 Application Architecture and Design was written by Vivek Thakur and published in 2008.

Who This Book is For

This book is intended for developers who have “basic understanding of the ASP.NET framework, and programming knowledge of either C# or VB.NET”, although it looks to me as if every example is written with C#. The word basic is a relative term, but Vivek seems to use it accurately – you don’t need to know that much about ASP.NET in order to comprehend this book.

Furthermore, Vivek states that “if reading about application architecture usually confuses you or sends you to sleep, then this book will be perfect for you!” He’s not lying. Vivek does an outstanding job explaining complicated concepts using everyday analogies.

Getting Started

Vivek starts the book by introducing the reader to the world of software architecture. He uses the analogy of an automobile company, where mechanical engineers, design engineers and the assembly line staff all have clearly defined roles – roles separated from each other for a variety of reasons. Vivek equates this process to that of the software “project life cycle”, and then moves into a discussion on software tiers and layers.

From there Vivek dives into n-Tier software architecture, giving some great examples along the way. I loved his approach to this topic because he starts at the beginning (a 1 Tier, 1 Layer application) and moves step-by-step towards a fully n-Tier application (his example uses 6 Tiers). The author also sticks to the same example (an order management system, or OMS) which helps the reader easily understand how a 1 Tier application is different from a 4 Tier.

I also really appreciated Vivek’s instruction on how to add new class libraries to Visual Studio. For readers who aren’t well versed in VS, this is definitely something useful.

Lastly, I thought it was a great idea to introduce the concepts of Data Transfer Objects (DTOs), Lazy Loading and distributing assemblies across multiple machines. Vivek’s explanations of each subject were clear and concise – perfect for readers with only “basic understanding of the ASP.NET framework.”

Moving On

About halfway into the book, the author moves into discussions of MVC and SOA design patterns. The only thing I really didn’t like was the introduction of the Windows Communication Foundation (WCF) in chapter 7, and that’s because Vivek only spent 4 pages on the subject. WCF is also the only .NET-specific topic in the entire book; I understand why it was introduced, but it felt rushed and (as someone who isn’t an expert ASP.NET developer) I didn’t get much out of it.

On the other hand, I really enjoyed Chapter 8 (Database Design). Vivek’s conceptualization of the domain model vs. the logical data model is spot-on, and I would recommend that any developer looking to build a database read it. I particularly liked the author’s example on page 197 for data normalization: who knew that the members of Metallica wrote books on ASP.NET? Sweet!

The Final Verdict

I definitely enjoyed reading ASP.NET 3.5 Application Architecture and Design. Overall, I think I would say that anyone interested in software architecture and design (regardless of the language used in development) could get a lot out of this book, minus a handful of exceptions (see my comment on WCF above).

Nice job Vivek!

Book Review: ASP.NET MVC 1.0 Quickly

Monday, January 4th, 2010

This review is part of a series of book reviews I have agreed to do for Packt Publishing. I am not being paid for this review, although I did receive a free copy of the book. I do not work for either Packt Publishing or Microsoft.

ASP.NET MVC 1.0 Quickly was written by Maarten Balliauw and published in early 2009. The book caught my eye as I’m currently working on a project using ASP.NET MVC and I decided I could probably benefit from reading this book.

Who This Book is For

This book is intended for “ASP.NET developers who want a fast-paced guide to building powerful web applications using the ASP.NET MVC framework.” I’ve been using .NET for a few years now, though admittedly I never learned Webforms. Although I consider that a blessing, a knowledge of Webforms is somewhat assumed in this book. All of the code examples are written in C# so you should be familiar with that as well.

Beginners may want to shy away from this book until they’re really familiar with web development concepts and know their way around Visual Studio.

Let’s Dig In


Chapter 1 discusses what MVC (model-view-controller) architecture actually is and dives into reasons why a developer may want to choose ASP.NET MVC over traditional ASP.NET Webforms. My only complaint about this chapter is that the author gives any reason to use Webforms. Yes, Webforms have a lot of built-in controls and event handlers – but let’s be honest, they’re not really very good tools. As a JavaScript guy, I’ll be the first to point out that you can develop data-driven solutions with frameworks like ExtJS that are cross-browser compatible and W3C compliant… plus your application will simply look better out-of-the-box.

Chapter 2 has the reader create a new MVC Application. Maarten shows us what a new MVC project contains by default (he calls it “inside the box”), which is a rather helpful introduction to ASP.NET MVC as it’s complete with screenshots from Visual Studio. I particularly like the “Employee” example, and Maarten does a good job showing the reader how the model/view/controller interact with one another. That being said, the author changes things in each class as the chapter progresses without highlighting or bolding the code sections which have changed – which makes it a bit hard to follow. Maarten also shows us how to build a Unit Test but doesn’t tell us how to run the tests.

The Train Runs off the Tracks

When I got into the third chapter, I have to say that I very quickly became frustrated with the author. Maarten says the following phrase at least 4 times in this chapter: “The examples in this section… can be found in the sample code for this book.” Translation: Go and download the code if you want to follow along, because I’m not going to explain what happens next very well. The book is less than 200 pages (not counting the appendices), and I really wish Maarten had simply pasted the code samples into the book.

I also felt like the author used too many customized examples (extending a built-in class to do X, Y or Z). I’ll agree that this kind of information is useful, but this approach forces the user to endure tangent after tangent. All I wanted was to learn how the MVC framework works – but the use of advanced examples prevents the reader from learning ASP.NET MVC 1.0 “quickly”.

Lastly, Maarten doesn’t talk about unit tests (one of the best reasons to use an MVC framework…) for most of the book. It’s mentioned in Chapter 2, but then we don’t hear about it again until Chapter 9. Personally, I think the author should have asked the reader to build a unit test for every example in the book – but maybe that’s just me.

Some Things I Did Like

Chapter 5 (Routing) had some useful information in there, specifically with regards to creating route patterns. I also enjoyed Chapter 7 (Using Existing ASP.NET Features), where Maarten explains how to use built-in ASP.NET features (like security, globalization, etc.) into an MVC application.

I’m mildly impressed that the author took the time to write Chapter 8 (AJAX and ASP.NET MVC) using jQuery in addition to ASP.NET AJAX. Good concepts, though Maarten again failed to tie any of this back into the previous 7 chapters.

Final Thoughts

I did get some good information from this book, and it’s probably worth reading if you want to learn ASP.NET MVC. I say “probably” only because I don’t know of any books which explain the concept more clearly or in a more organized fashion.

In my opinion, it would have been much smarter to have had the reader build a single application – adding features and parts as each chapter introduced a new concept. But Maarten Balliauw didn’t do that, and I think it really hurts the book. The reader is forced to jump from concept to concept, and not all of the examples follow the “best practice” for an MVC application – to separate functionality into complimentary models, controllers and views.

For example, Chapter 3 has a “Contact” model which interacts with the “Home” controller. There is no “Contact” controller in the author’s example, and we never actually create a view. (I take that back… it might be there in the book’s sample code – but I, like many readers, will never bother to download it.)

The biggest problem for this book is that it reads like a college textbook. It’s full of good information, but students want to learn by doing rather than memorizing definitions and abstract concepts.

Overall, I’d give the book a 3 out of 5 stars. Not terrible, but far from great.

Issues with GoDaddy Hosting Connection

Wednesday, July 15th, 2009

I’ve been a customer of GoDaddy for several years at this point, and for the most part I’m a happy customer. Their prices are always among the best, their servers almost never go down, and their customer service representatives really seem to want to help me when I call.

However, I have also been a critic of their technical support staff. As a professional web developer I have a solid understanding of server configurations and language-specific coding practices. When I have run into development issues with my GoDaddy hosting accounts, my experience has been that the tech support staff has far less experience than I do. . . meaning that they rarely understand what my problem is, let alone how to solve it. (To their credit, they are a friendly bunch.)

This brings me to the GoDaddy Hosting Connection. If you’re not familiar with this service, GoDaddy basically offers to install a number of applications on your behalf (I’m assuming via some automated scripts). This sounds like a really nice feature, and GoDaddy will argue that it helps to make them the best choice to host your website.

Over the past day or so, I’ve been attempting to play with DotNetNuke which is one of many CMS tools offered in the GoDaddy Hosting Connection portal. Sadly, I’ve run into so many issues with their automated installation that I think I’m seeing more gray hairs. The installation of the application to my hosting account seems to succeed when you look in the GoDaddy Hosting Connection, but attempting to walk through the application’s setup is a very frustrating experience.

For starters, the installation script fails to notice that particular assemblies linked in the web.config file are already installed which results in a nice 500 error. Because the “customErrors” value is set to “RemoteOnly”, novice .NET users have no idea what the hell happened. Changing this value to “Off” allows you to see the errors, and you are forced to remove the fault lines in web.config to proceed with the installation. The errors I saw were different on my IIS6 and IIS7 accounts, and I have no explanation as to why.

Getting past the annoying 500 errors, my IIS6 setup seemed to move forward without too many problems. IIS7 on the other hand fails when DNN upgrades its database – its hangs on version 4.8.1, and no error is output to the screen. I waited and waited and waited for it to complete, but I eventually gave up. I never got DNN running on my IIS7 account.

Once I got DNN up on my IIS6 account, I noticed that all of my links had a hard-coded path to the subdirectory in which DNN was installed, despite the fact that I had the subdirectory aliased as a domain root. While this doesn’t prevent the application from working, it’s a problem for SEO and simple user interaction. After searching the Web for possible solutions, I dug into my SQL database looking for that value. I couldn’t find it. With a bit more digging, I find in the admin portal that DNN automatically assigns a “relative path” to my application because I didn’t install in my hosting root. As far as I can tell, there’s no way around that on GoDaddy.

I spent about another 10 minutes fidgeting with DNN host settings and somehow managed to break DNN completely (I sent it into an infinite loop). I have no idea what I did. *SIGH* I’ve uninstalled DNN for like the 10th time and am giving up. I’m going to try Joomla (also offered by GoDaddy Hosting Connection) but my faith in GoDaddy is growing thin.

WhyILoveChicago.com Update

Friday, May 8th, 2009

Over the past week, I’ve spent some time updating WhyILoveChicago.com with a much-needed facelift.

For starters, the site is now coded in .NET!

I also made the template much wider than before, and started promoting the various parntnerships I’ve formed (notably StubHub and Hotels.com). The homepage has also been updated with a YUI TabView object, which really adds some flair.

Sadly, I’m failing to get GoDaddy to properly handle my 404 redirects. . . which might bite me in the ass for SEO. Since the old site was coded in Classic ASP and the new site is in .NET, I can’t brute-force the 404 redirects in Classic ASP. I’m really hoping this won’t kill my organic search revenue!

If anyone has feedback, I’d be really happy to hear it!

ExtJS and Script#

Monday, March 2nd, 2009

Over the past few weeks, I’ve come to the realization that trying to organize more than 10,000 lines of JavaScript code is just a silly idea… and by “silly” I mean really ridiculously painful.

I’ve been building a highly complicated software solution over the past six months at my office, and our UI is built entirely on the ExtJS framework (hooray for AJAX!). The solution runs on SQL Server, and the backend is written in C#.

Since our team of developers uses Visual Studio for our IDE, I thought it would be awesome to find a tool which might allow me to more easily organize and document the UI code. Visual Studio handles C# documentation and unit testing as part of the build process (compile-time) — a task which completely ignores anything to do with JavaScript (runtime).

After searching Google for a day or so, I stumbled across some cool C# extensions: Script# and Ext#.

Script# basically allows the developer to write C# classes which are compiled into a JavaScript file for execution in the UI. Since the classes are written in C#, you get the added benefit of easy documentation and the abilty to write unit tests.

Ext# a project that attempts to translate the ExtJS libraries into Script#. According to their site, they’re up to version 2.1 (current ExtJS version is 2.2).

What did I find?

  1. Script# is not well documented. It was a pain in the arse to get working, and has errors in Firefox.
  2. Ext# is a great idea… but with Script# being a pain and not widely supported, I can’t trust it.

Despite my initial feelings on Script#, I would be using it IF the MVC platform worked with it. MVC is incompatible with the way Script# renders its JavaScript code at runtime, which sucks as our software solution is based on MVC.

Back to the drawing board…