Book Review: ASP.NET 3.5 Social Networking by Andrew Siemer

A while ago I was approached by Packt Publishing to see if I was interested in reviewing a copy of one of their books. The topic of the book they had in mind (ASP.NET 3.5 Social Networking) is closely related to my own work so I said yes.

Introduction

At first sight, the book ASP.NET 3.5 Social Networking looks very promising. Its title suggests a deep dive into the inner workings of large, community driven network sites built with ASP.NET 3.5. The very first chapter lists and compares a few large community sites like Digg.com, LinkedIn.com, Facebook.com and Twitter.com so I was hoping that the author was going to cover many of the topics that drive these sites, setting me up with high expectations.

The book starts of with an introductionary chapter on communities in general, and some of the common pitfalls you may encounter. It then introduces the Fisharoo social network site - the sample site built and demonstrated over the course of the book. Fisharoo.com is a community site for fans of fish and aquariums and offers many features that other network sites offer as well. The first chapter ends with a short introduction of each of these features, including:

  • User accounts
  • Profiles
  • Friends
  • Messaging
  • Media galleries
  • Blogs
  • Message boards
  • Groups
  • Comments
  • Tags
  • Ratings

Each of these topics has its own chapter where you'll learn more about the feature itself, how it works, and how it's designed and developed.

Each chapter follows a "Problem Design Solution" route (which should be familiar to many Wrox readers as they have a Problem Design Solution series as well that follows the same structure. Also, if you are a Wrox reader, check out the Preface section and try if you can spot some more familiar things). At the beginning of each chapter you'll learn more about the actual feature and how it is used in the Fisharoo site. The author then spends a good portion of the chapter outlining the design, including database diagrams, LINQ to SQL diagrams and the use of third party tools and frameworks. The largest part of the chapter is spent discussing the actual implementation. You'll see the code for each feature (a lot of that; I'll return to that later), the way different modules can interact and you'll learn how to acquire, install and configure some popular third party tools including:

Using these tools, Andrew shows you how to build a modern, properly layered web application using best practices that should be easy to maintain in the long run. The Fisharoo web application shows the following best practices in n-layered web application design:

  • MVP (or Model View Presenter, a concept related to ASP.NET MVC recently released by Microsoft)
  • Dependency Injection or Inversion of Control (IoC) where you program against interfaces and postpone the decision of a concrete implementation until run-time. With the open source tool Structure Map this is really easy and straightforward, and hence more than worth checking it out. In the book, Andrew wraps about anything in a Wrapper class making it easy to swap out two components, while maintaining compatibility with the rest of the application.
  • Separation of concerns. Rather than creating large, bloated web pages or helper classes Andrew has created a design where each class just serves a single purpose. This makes it easy to replace the class, or change it, without breaking other functionality of the system.
  • A properly disconnected data access layer not tied in to the other layers.The choice of LINQ to SQL may turn out to be a bad one in the long run as it seems the ADO.NET Entity Framework is going to take over. But even then, replacing LINQ to SQL with the EF should be easy in this clean design.

Most of the chapters are pretty similar in concept. You see how to build Blogs, a Media gallery, an on-line messaging system and more, all using the Problem Design Solution structure.

Considering the high expectations I was having at the beginning of the book, you may wonder whether the book delivers or not. The answer is yes and no.

Just recently I was (and still am) involved in the design of a very large, internationally oriented community site. This means I have seen the things that Andrew is discussing from a very close range. Seen it, done that, been there - that kind of stuff. Some of the design principles used in the Fisharoo site are applicable directly in the project I am working on. Some were already there, but for some others Andrew inspired me to think differently about the design decisions I have made, causing me to redesign some elements in the near future. Also, the description and demonstration of the many (open source) third party tools used in the sample site will help you rethink your own web strategies and design decisions.

However, I also think the book is really missing some important things:

  • Localization / Multi-lingual web sites
    Not all of us live in the USA and not all of us can get away with a simple regular expression for a US zip code. For many of us outside the USA (and for many others inside the USA with an international target audience) localization is real problem and a hard problem. The book could really have benefited from a chapter on localization that shows how to localize the UI, how to design the database so it's able to store an unlimited number of translated versions of some piece of content, how to use ASP.NET Localization resources to translate UI elements, how to deal with cultural differences in presentation for dates, currency, etc, how to enable site managers to easily manage all this localized content, and so on.

  • Extensive and broad networks
    With a title of "Social Networks" I was expecting to see a lot of coverage of how to design an build a good network of contacts. While the book deals with the concepts of friends in chapter 5, I found the coverage quite limited. It mainly demonstrates working with friends in the first degree; e.g. the ones you know and the ones who know you. While the database is designed to store an unlimited depth of connections using a self referencing table with contacts, the front end of the site doesn't really show that off. I was hoping to see coverage of stuff like the Connection Network map used in Linked In where you can see connections at multiple levels in a community map and see how people not in your first degree network are related to you through others. Additionally, I was hoping to see more on how to relate connections, how to detect updates in the forest of relations, how to do stuff like "Since you know Harry, there's a fair chance you may also know John" type of features.

On top of these two big omissions, the book has a few other issues, the most important one being the code presented in the book. There is way and way and way and way too much code in the book; sometimes up to three or four pages in succession. Not a fun thing to read, so I often found myself quickly flipping through a chapter skipping most of the code (which caused my girlfriend to say that it looked as if I wasn't reading a very interesting or good book). In my opinion, more than half the code could be removed, making the book slimmer and a lot more interesting to read. That would mean the end of code examples with half a page of C# using statements and stuff like the example on page 66 and onwards that shows the code for a Log class. This class contains a gazillion overloads that do nothing more than calling some other internal overload. Rather than copying the code in its entirety, a simple Class Diagram showing the overload signatures together with the code for one or two overloads in detail would have been a much better option.

The code download that comes with the book needs some brushing up as well. The entire solution doesn't compile out of the box and the source folders contain a lot of bloat like personal .suo, cache and other unneeded files making it sometimes difficult to see what's relevant and what's not. However, the clear design and the inclusion of all the third party projects discussed in the book more than make up for this.

Despite these shortcomings, ASP.NET 3.5 Social Networking is still an interesting read. You'll see many good design principles (both the design *and* the actual implementation), see a lot of best practices and you'll learn something about fish tanks along the way ;-)

I would give it a four star rating if I was writing this on a site like Amazon. I'd give it 4.5 stars if there was less code in the book that I easily could have looked up in the (huge) code download that comes with the book.

 


Where to Next?

Wonder where to go next? You can post a comment on this article.

Doc ID 486
Full URL https://imar.spaanjaars.com/486/book-review-aspnet-35-social-networking-by-andrew-siemer
Short cut https://imar.spaanjaars.com/486/
Written by Imar Spaanjaars
Date Posted 02/07/2009 18:44

Comments

Talk Back! Comment on Imar.Spaanjaars.Com

I am interested in what you have to say about this article. Feel free to post any comments, remarks or questions you may have about this article. The Talk Back feature is not meant for technical questions that are not directly related to this article. So, a post like "Hey, can you tell me how I can upload files to a MySQL database in PHP?" is likely to be removed. Also spam and unrealistic job offers will be deleted immediately.

When you post a comment, you have to provide your name and the comment. Your e-mail address is optional and you only need to provide it if you want me to contact you. It will not be displayed along with your comment. I got sick and tired of the comment spam I was receiving, so I have protected this page with a simple calculation exercise. This means that if you want to leave a comment, you'll need to complete the calculation before you hit the Post Comment button.

If you want to object to a comment made by another visitor, be sure to contact me and I'll look into it ASAP. Don't forget to mention the page link, or the Doc ID of the document.

(Plain text only; no HTML or code that looks like HTML or XML. In other words, don't use < and >. Also no links allowed.