Rating: 4 out of 5
A much-needed literary slap upside the head for ASP.NET devs
"Real World ASP.NET Best Practices" is a great and much-needed literary slap upside the head for those of us who haven't been squeezing the most out of our apps. If you already know you're stuff with ASP.NET, get your hands on this book and get a very positive reality check.
Since having worked with ASP.NET for a few years now, I've been on the hunt for a new book that goes beyond the introductory/intermediate description of how ASP.NET does what it does in the aggregate. I don't need an omnibus discussion ASP.NET in the aggregate, detailing how to populate a drop-down list or connect to a database, and the obligatory of how to create a "Hello world" XML Web service. I wanted a title that would focus on a niche aspect of ASP.NET Web development, and that's precisely what this book delivers.
The book could also very fittingly be named, "The Things We Like Best About ASP.NET - 2 Dudes and their Opinions." And this is a good thing. The authors do a great job of providing you with helpful tips to hone, refine and enhance your existing ASP.NET savvy to be able to write code less, smarter, and more productively.
It provides closure for all-too-common developer inquiries like: what's faster - a DataReader or a DataSet? Which Web server control is more top-heavy - a DataList or a Repeater? It also demystifies the mighty, mighty DataGrid and shows it's not the all-encompassing solution many may think. Further, it addresses the much-misunderstood mechanism of suitably using client-side JavaScript in your ASP.NET WebForms.
You'll find lots of accommodating code methods, syntax tidbits, and general concepts buried deep within the .NET Framework to let you write more productive apps.
WHAT I LIKE
• Phenomenal chapter on caching - when to use it, and when it's more of a burden than a blessing for your apps. This is one of the best discussions on the topic I've found in print to date.
• Great ADO.NET coding techniques are enforced throughout the book, showing how to effectively/efficiently connect to, disconnect from, and destroying database communication objects
• Comparing the true best way to persist data across pages and postbacks
• Tips and tricks from classes and interfaces within the .NET Framework that have gotten little fanfare or have gone largely undocumented, such as various sues for the IList interface C#'s 'lock' keyword help out a lot.
• I enjoyed the section on the dangers of overusing dynamically-loaded users controls, adding severe overhead to your app
• The portion of why it's not a bright idea to use business logic within a DataSet is really eye-opening
• I like the fact the concepts are supported by metrics in Application Test Center, demonstrating the relative performance of a code block in the real world. Although numbers don't lie, but they don't tell the whole truth, this is a much-needed addition.
• The chapters are short, to the point, but still chock-full of great content, not inundating the reader with extraneous information.
• Included is a very nice discussion of performance optimization through proper development of an app's web.config file.
WHAT I THINK NEEDS WORK FOR THE SECOND EDITION
• The code samples are inconsistent, with half of them being in C# and the other half being in Visual Basic .NET. Also, the VB.NET chapters tend to be so tightly married to Visual Studio .NET coding that it makes migration out of it rather difficult
• The writing style has a tendency to display the occasional grammatical abnormality, (e.g., "know how to properly use DataSet")
• I was hoping to see a discussion of performance optimization within the context of a tiered application, specifically tweaking your data access layer (DAL) for maximum speed. This isn't a biggie, just maybe a suggestion for the next edition.
I would rate the book 4 out of 5. Forgiving the editorial snafus and the code inconsistencies, I really had a positive experience reading this book. It's not the same old take on ASP.NET, and you'll be a better off and more well-rounded developer, now conscious of the major considerations behind your app's curtain because of it.
Rating: 5 out of 5
Written by Colt Kwong for ASPAlliance.com
This book will definitely inspire and enrich you.Overview -------- I'm glad to have read the book "Real World ASP.NET Best Practices" by Farhan Muhammad and Matt Milner. This book contains lots of practical and useful knowledge, excellent practices of ASP.NET web applications and the experience and wisdom of the authors themselves - as stated in the title of the book "Real World". This book is suitable for intermediate to advanced ASP.NET developers and architects. It doesn't show any detailed code listing with explanation but shows best practices and explanation on the creation of the application as well as what should be considered when developing a web application. Summary ------- Chapter 1: The Age of ASP.NET This chapter mentions the history of classic ASP and ASP.NET and explains the concept of the new model named Code Behind in ASP.NET. This chapter discusses the benefit and mechanism of using Code Behind and it also explains how to apply it in an object oriented programming model on top of the .NET Framework. This chapter has a 3 page long example of Master Page (with code) showing the features of inheritance in ASP.NET. Chapter 2 - Cache, Session and View State This chapter explains what is caching very briefly, but it discusses the pros and cons of using cache in a web application in detail. Instead of throwing everything into cache as shown in many ASP.NET and ADO.NET books in the market currently, this chapter carries out a series of performance tests using Application Center Test. It also shows when and how to use cache effectively and turbo charge web applications. The authors explained how to enable ViewState wisely and demonstrated the best practice to use either types of Session state by performance test as well. Chapter 3 - Client-Side JavaScript: Oh, What Fun! This chapter demonstrates how to implement and hook client side script in ASP.NET and presents an example Photo Album with the use of JavaScript. This chapter mentions the best practice of using JavaScript in ASP.NET, including the pros and cons of hardcode and softcode client script and how to design a flexible and reusable script block for web application. It uses a single example throughout the chapter with different approaches and source code included and explained in each approach. Using JavaScript on web pages is kind of fun and good performance-wise, but I think readers do not have much interest in reading every single line of code about injecting JavaScript to Web form indeed. Chapter 4 - Handling Data Effectively This chapter covers a couple of key topics in handling data, like data binding with DataTable and DataView, creating strongly type collections and implementing the IList interface. This chapter tells you how to handle data by using business objects and custom collection objects, too. In addition, to show how to create a custom collection object by yourself, this chapter also demonstrates how to implement search, filter and sort ability per custom collection object. This chapter suggests and provides guidelines for data binding and is a must read chapter before you are going to design your next database related application in an object-oriented manner. Chapter 5 - Using ASP.NET to Manage Lists There are mainly 3 server control for binding and displaying data in ASP.NET, and the confusion that most ASP.NET developers would face is the similarity and difference among these controls. This chapter examines these controls in detail with the use of Application Center Test, including the productivity and performance points of view. This chapter also mentions 3 ways to customize data controls with explanation of usage and performance aspects. Chapter 6 - User Controls and Server Controls This chapter reveals the benefits and practices for these 2 kinds of controls, compares and explains how to choose either one in different scenarios, depending on scale and requirements of the application. The authors assume the readers know how to develop user and custom controls and show an example about creating a custom control with JavaScript as well, where readers can refer to what they have learned from chapter 3 easily. Chapter 7 - Remoting and Web Services The topic of this chapter is one of the hottest discussion topics in online communities, and is frequently encountered by software architects when designing a distributed and scalable system. Unlike the generic response - "Depends" - this chapter firstly describes the overview of each mechanism, and describes the best practices that are common to both mechanisms, and then eventually mentions the best practice of each of the mechanisms in detail. Thus. you can understand why and how to choose the best one for yourself by reading in this sequence. Chapter 8 - Configuring ASP.NET Applications This chapter does not tell you what the elements are in the configuration files, but it shows how the system works behind the scenes. This chapter shows the best practices like how to employ external configuration files, reference to an external configuration file in web.config file, and explains how and when to use a custom configuration file and setting. This chapter contains detailed information that is seldom found in other ASP.NET books. Conclusion ---------- All of the chapters are the hottest discussion topics and/or issues that confuse most people today, but the authors highlight and explain the pros and cons and the reason for creating ASP.NET web applications in such ways. Although this book does not have any actual exercises / hands-on examples, readers can follow and learn from it easily, and say "gotcha" throughout reading it. This is a great book if you have the basic knowledge of ASP.NET and want to find some breakthrough in your technique and knowledge in ASP.NET. Reading a book full of the real word experience and wisdom of the authors will definitely inspire and enrich you.
Rating: 5 out of 5
This review is written by Rob Harrop for ASPToday.com
You will refer back to this book again and again.Target Audience --------------- This book is primarily aimed at developers who have been working with ASP.NET for some time and now want to consolidate their skills and implement best-practise solutions. The book assumes that the reader has a degree of prior knowledge, so you will find that instead of offering an introduction to a topic such as ADO.NET, the author instead moves straight to pointing out common mistakes and effective solutions. Code examples are presented in a mixture of C# and Visual Basic. NET, so you will need to be able to read both comfortably to get the most out of this book. Overview --------- One thing I often find with technical books is that they are just too technical. Often it is as though the author is trying to prove their own superior intellect and they indulge in horrendously complex explanations of even the simplest topics, which more often than not results in an alienated reader who is no more enlightened than they were when they started the book. What instantly struck me about this book was the fresh and light tone used in such a "high-level" book. When reading this I found that the authors' friendly and concise narrative helped me to grasp the concepts being described that much quicker - this was certainly one the quickest reading books I have read in a long time. Topics Covered -------------- Faithful to the title emblazoned on the cover, this book provides a useful selection of best-practises based on the real-world experiences of the authors. The topics are more often than not non-nonsense coverage of the best way to achieve a given task. As you progress through the book you will no doubt see some practises you currently employ and some that you do not. This book is certainly one that you find yourself referring back to again and again. The book covers core topics and offers a selection of best-practises relevant to each: General best practises - This section covers the general best practises that apply to all ASP.NET and indeed to development in general. Most of the recommendations made here are just good OO practise, but there is a good section on getting the most out of code-behind in ASP.NET. The author presents useful topics such as directly sub-classing the Page class to create your base class that can be inherited by all your code-behind classes. There is really useful example of encapsulating objects stored in the session state and then providing properties on the ASP.NET page base class to access them from all your code-behind classes. Using client-side scripts - Out of all the sections in the book this was my favourite. The coverage is very good and provides some useful insights into the appropriate usage of JavaScript within your ASP.NET site. Leveraging caching - The section on caching provides a good look at using both the Cache object and also using ASP.NET page and page fragment caching. This section is particularly well backed up by the usage of Application Centre Test (ACT) to provide performance metrics for both cached and non-cached versions of the same sample code. Session Management - For session management the author takes the time to look at how the different session modes perform not only on a single machine but on multiple machines. He then combines the solid figures from ACT with each modes usefulness in a particular situation to provide a full overview of when and where to utilise each session mode. Data access - With this section I found myself disagreeing with some of the samples provided by the author, specifically I didn't like the way they passed an IDataReader instance to a business object so it could populate itself, my feeling is some kind of factory object would have been better. However, the resulting best practice is a good one and the author also takes the time to look at alternatives you may consider and why they are not as good as the code he is recommending. Data Binding and Server Controls - The practises laid out for these topics are particularly good as the author has looked at different ways to use the various the server controls to maximise the performance of your application. Again this section is backed up performance metrics taken from ACT so you can actually see the difference in performance as opposed to just imagining it. User and Custom Controls - Rather than focus on the performance issues of controls, although this is covered under partial page caching, the author looks at when each type of control should be used and how to get the most out of each technology. There is some particularly good coverage on the usage of Custom Controls that you may find useful. Summary -------- After reading this book, which I might add took no time at all thanks to the relaxed writing style; I was certainly left feeling somewhat wiser. The information presented is relevant, useful and also backed up by actual evidence in the form of performance metrics. This is certainly not a book for beginners; if you want to learn about ASP.NET then I recommend you try Beginning ASP.NET 1.0 by Dave Sussman et al. but experienced ASP.NET programmers will find this a useful and informative book. Something you should keep nearby at all times.
|