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 read existing comments below or you can post a comment yourself on this article .


Consider making a donation
Please consider making a donation using PayPal. Your donation helps me to pay the bills so I can keep running Imar.Spaanjaars.Com, providing fresh content as often as possible.



Feedback by Other Visitors of Imar.Spaanjaars.Com

On Saturday, April 04, 2009 12:39:45 AM gurjeet said:
Hi Imar

I really admire you.Coz whenever I come to your site I learn something great and this gives me wonderful feeling.Thanks.
On Tuesday, June 23, 2009 9:28:26 PM Andrew Siemer said:
Thanks for the great review!  I agree 110% with everything you said.
On Tuesday, October 13, 2009 10:09:02 AM angshuman d said:
how to design "friends social network sites" using asp.net with C#
On Tuesday, October 13, 2009 7:05:57 PM Imar Spaanjaars said:
Heuh? What? How about reading this review and then buying the book?

Imar
On Sunday, January 10, 2010 12:23:17 AM James said:
Personall I thought this book was horrible and a complete waste of time and money. Although it does go over some good best practices, there is ZERO structure to the book. It is full of many errors:

1. Code that is written sloppy and doesn't work.
2. Doesn't explain how/where to attain some of the images and code referenced.
3. Explains that the author assumes you are familiar with certain aspects already, but doesn't explain what those aspects are then skips over a great deal of instruction assuming you will figure it out and follow along.

I put the book in the trash after the 3rd chapter. Waste of money...
On Sunday, February 28, 2010 9:21:22 AM richy said:
i totally agree with james and the rest of you the book aint worth its price the source code does not compile a lot of errors on compilation i will give it three out of ten.please do lots of testing before publishing a book for sale so as not to loose customers i have put the book in the recycle bin.
On Wednesday, March 03, 2010 1:46:44 AM Andrew Siemer said:
James and Richy - I am sorry that you had issues with the book!  I wish you would have contacted me for the areas that slowed you down.  I would have loved to help you.

I am only aware of a couple of issues with the code that was delivered with that book.  I will say though that all of the issues that were brought to my attention or to the attention of the publishing company were addressed immediately.  All issues were supported either through the Packt staff or on the forum that I set up as soon as the book came out.  I still interact with people on that forum or through email or via chat!

I do have to say though that the book was not for beginners.  I dont' think that that point was made clear enough.  The use of StructureMap and some of the more complex design patterns seemed to really throw a wrench in the system as it pertains to people getting their code up and running!
On Saturday, July 09, 2011 9:35:51 AM Charlie said:
I seem to have no problems testing the code but I did have to rewrite half of it to get it to work correctly and there are many unconventional methods that I completely removed. Good Luck
On Thursday, September 01, 2011 11:21:59 AM ashwini said:
thankyou,book is just magical flow of practical knowledge to boost  initial developers
On Sunday, September 04, 2011 8:16:46 AM A.Dey said:
How can I add CHAT facility in my social network using Asp.net??
On Sunday, September 04, 2011 8:36:55 AM A.Dey said:
Plz name some books that would focus on details abt adding CHAT facility in a social network using asp.net and ajax..
On Sunday, September 04, 2011 10:10:54 AM Imar Spaanjaars said:
Hi there,

You may want to take a look at ASP.NET 2.0 Instant Results (http://imar.spaanjaars.com/about/aboutmybooks/instantresults) which features a chat application. Not sure how current it is though compared to newer books / applications.

Cheers,

Imar
On Thursday, November 03, 2011 4:59:53 PM jerry said:
Hi Imar, Please name the best book to start with social networks in asp.net and ajax. Thnks!
On Thursday, November 03, 2011 5:29:12 PM lucy? said:
hI Imar, write a book about social networks, like planetwrox but with chat and contacts, and friends and something like that please!

I understood your book from principle to end! :)
On Saturday, April 07, 2012 10:50:15 AM mansi said:
please mail me the e book of
asp.net 3.5 social networking by andrew siemer
On Saturday, April 07, 2012 11:51:27 AM Imar Spaanjaars said:
mansi,

What? Try this: http://www.packtpub.com/expert-guide-for-social-networking-with-asp-.net-3.5/book

Imar

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 QuickDocId of the document.

For more information about the Talk Back feature, check out this news item.