July 2008 - Posts

Introduction

In Egyptian Developers Conference (EDC) 2008 this April, my geek network noticed a very nice, cute, and sweet little girl with me that I was very proud to introduce not just as one of the cleverest developers in SilverKey, but also as my life mate, my fiancée. Not sure if any of you noticed that by then, although being engaged, we were not wearing rings, yet!

Well, WE DID FEW HOURS AGO! Yes, I now wear a ring with Mona's name on it. What a pleasure that is? To understand, you just need to meet her once. I'll try to give a VERY limited summary of it.

Getting deep into the picture

Mona is a solid geek who just "gets it" when it comes to C# 3.0, jQuery or ASP.NET MVC and all this patterns stuff. That's easy to guess about my fiancée and is very true about Mona. However, this is a VERY MINOR great thing about her, and didn't get much of my attention because it is one of near infinity (at least I'm discovering new great thing every other situation/talk). Besides being so smart and having this great look that makes you feel so calm and comfortable when seeing her, she also has a TRUE pure soul that accepts no harm to anybody on earth and perfectly matches her soft but not easily to be broken nature. Somehow, she merges all this with such a cool nature with a great sense of humor, all this with a very admirable respect to herself being a moderate Muslim.

She has an impossible combination of great talents, skills and natures that I only mentioned the very basic ones of. You can add to that impressing wisdom, talk about a hundred type of kindness, or go talk about the sweetness that shows in every movement or word that comes out of her. I'd dedicate a series of blog posts to talk about each of her greatness as I "mentally" measure them vs. tons of other people I met in my life, counting males and females of all ages, starting at age 8 and above (say in cuteness/sweetness, …) going through 20s to 40s (say in beauty and humor, …) to 50s and counting (say in kindness and wisdom, …). This got me to a conclusion that such person is very rare to happen to exist in the entire world not just in my life.

The Big Pre-Event

So, now that such a rare existing person accepted to spend the rest of her life with such a normal guy whose only good thing is being just another geek of thousands around the world and in Egypt, that is something that makes me so proud.

Having the symbol of it in her hand having my name on it is a true charm that will help me wait the months it takes till we are married and living in the same house. Another wonderful thing is that I now "wear her name" in my hand represented by the ring that has just few hours ago got into my right hand and will hopefully soon move to the left one.

Thank you very much, Mona, for showing yourself in my life. Thank you way more for accepting sharing your valuable life with me. This is the favor of my entire lifetime. I know I cannot reward you for it whatever I do, so, all promise is to still try my best.

I love you, my little sweet cute smart girl.

Thanks again.

I found this great article that tells you how to do testing for WCF services exposed as web services, especially REST services (like the ones we create in my company for the project I work on now).

What’s the problem ?

Typically, for HTTP GET services, you can just put a URL that matches the URI template of the service (the template of the URLs that call the service) in the browser, and simply see what comes back in the browser itself

However, when you want to test a service with other HTTP verbs than GET (Say POST, PUT), you need a console that creates the HTTP request with headers and request body and such, because a browser normally has no way of making you create a new customized request (because it creates them for you and encapsulates the entire process of request/response).

Usually you write that console on your own. We wrote one for the current project but it didn’t serve all our needs.

The solution

There’s a program called “Fiddler” (Microsoft Freeware). This program works as proxy server that allows you to intercept and inspect requests and responses for all the web calls you do from your machine. This is very useful but as Firefox extensions do this for us, I haven’t personally installed it for a while.

However, Fiddler has a great feature called “Request Builder”. This is where you can construct your request with all parameters and such and change any part of it (headers, body, raw request) and see the response in multiple views (Raw, Text XML, …).

You can put the URL of your service in it, choose (or type) the HTTP verb and HTTP protocol version (by default 1.1) it uses, and then check the result to see whether it is what you expect or what.

Notes on usage

  • With Vista or IPv6 supported OS, this fails sometimes especially when your service is hosted with ASP.NET development server (that’s included in Visual Studio). To fix that in Fiddler, go to Tools->Fiddler Options and then uncheck “Enable IPv6 (If available)”.
  • This is how Fiddler looks like in sample test
    clip_image002
    Note that:
    • The part to the left is the previous HTTP connections. You can fill the request builder parameter by dragging any of them.
    • The “Content-Length” header is filled with the right value automatically for you by Fiddler itself.
  • An important part to enter in your requests is the “Content-Type”. Many services would behave differently according to that. For an XML web service, that’s typically a new line with “Content-Type: application/xml” in it.
  • Fiddler configures itself as proxy for IE automatically. Firefox by default does not use a proxy server. To make Firefox it use Fiddler, from Firefox go to Tools->Options, then the “Advanced” tab, then “Network” sub-tab, then in the part “Connection” click “Settings”. Then
    • Click “Manual proxy configuration”
    • Enter 127.0.0.1 in “HTTP Proxy” (and “SSL Proxy” if you want this for HTTPS) and then “8888” (default port for fiddler, can be changed from it) in the “Port”.
    • Clear the “No Proxy for” textbox to be able to test URLs on “localhost”.
      You can alternatively keep it and use http://MachineName instead of http://localhost when testing.
      clip_image004

The One Resource for This

This is coming from a great article that talks about the topic (but not with all the notes). The article also shows a VERY NICE example of creating a REST web services WCF project to be hosted in IIS.

Go read it right away.

In my company, we agree on certain subject macros for articles, news and similar non work related messages. Each of us creates his own Outlook 2007 Rules to move those to specialized folders.

The drawback of this is that new messages that get moved to other folders than Inbox do not have the desktop alert:

clip_image002

You do not know whether you got a new message or not.

This might be OK for messages flagged [fun], but as I have been in the company for long, I used to have folders for each of my complete projects messages in case I get a maintenance message or so. The project I work on right now has its own mailing list, so, I move its messages to a dedicated folder. I cannot afford missing instant note of an email in the project I work actively on right now!!

If you face a similar situation, it has an easy fix to get the desktop alerts for all the messages you need it for. Actually it’s no more than creating another Outlook folder :).

Let’s see how easy it can go:

Start by going to Tools-> Rules and Alerts …

clip_image004

Then click “New Rule…”

clip_image006

Make your selection as below and click “Next”

clip_image008

See if you need to apply this to only certain messages, typically just click “Next”

You may get a confirmation message. Just click “Yes”.

clip_image010

The last step is to select “Display Desktop Alert” and click “Finish” and "OK" to next messages.

clip_image012

 

Hope this helps anybody in similar situation.

 

I’ve have just sent this email to the developers exchange group in my company:

I think you all know the routing engine that works with ASP.NET MVC framework to enable customizing URLs and mapping those to the corresponding controls, actions and their parameters.

Some of you may know too that the routing engine is not just for ASP.NET MVC, but ASP.NET in general. If you happened to download the source code of the ASP.NET MVC framework (any preview), you’d have noticed that the routing comes as DLL not in source code format like other parts of the ASP.NET MVC framework.

I have found an interesting series of articles going through the routing assembly that I thought you might be interested in:

I found them at: http://msmvps.com/blogs/luisabreu/archive/2008/07/04/the-routing-series.aspx

Regards,

Mohamed A. Meligy
SilverKey Technologies - Egypt

Senior Software Engineer

Hope that helps somebody.

I feel shamed for not writing genuine articles for long. This is to come soon (God Willing). Maybe in two weeks or hopefully less.

So, it has been exactly a week since I have been to dotNETwork 5th gathering. This is yet one of my too late events coverage (maybe I should write a long boring post about why that happens lately in as much annoying details as possible!). Let’s  hope we have something worth the wait this time …

Intro (No tech – you can skip)

This time I’m talking about the second session in the last gathering. The 1st session was already covered earlier. This session is special to me for two reasons: It was delivered by my of my dearest friends in the field, Mohamed Samy. I know Mohamed four years ago, since He was moving from VB 6 to C#, until he became one of the super guys in the field of enterprise computing and architecture in the .NET in Egypt, being a technical architect in ITWorx, one of the top posters in MSDN forums, and finally getting his Solution Architecture MVP lately (which he tells us a story about). The second reason is that I had the pleasure to see the latest part of his preparations for the session, and it was very interesting to see “the making” as well as “the show”.

Anyway, getting back to the session… The microphone stopped working at the very beginning. Mohamed moved to the middle of the rows and looked like a student leader talking to his fellows. this warmed things up a lot as well. He started warming them up by going really quick on his start as a developer, and choosing to continue in the technical career path (technical lead, architecture) while most prefer to take the manager path (project management, etc). He told us about his MVP how he was so happy to earn it in “Solution Architecture” then having the “Solution Architecture MVP” canceled, and having to choose a product specific MVP award instead. He went for “VSTS MVP” as relatively a bit close to his work, having “Solution Architecture” as a “competency” to the “VSTS MVP” award.

As we got lost in our way to the CIC (Canadian Collage, where the gathering took over), he mentioned that software is like finding the CIC, you ask people you find in your way about the road to go, each gives you a different answer. You need to get to that road and not ask again.

Going more into the session

Buzzwords

Mohamed went through how “XML” suddenly became a buzzword. People tell you you’ll get rid of SQL and Oracle and replace them with XML files. It’ll solve all developer problems, and all this kind of talks. He bought a 1500+ pages book about being “proficient in XML” and he still didn’t understand what XML is really about. This is a buzz, just like the university sign, it tells you go certain way and everybody just follows. Later Mohamed recognized the simple fact that XML is just a text format based on tags that can be consumed within any platform. This is good because it solves communication problems between platforms (say COM from Microsoft and CORBA from Java) that were problematic because of using specific binary formats not text formats that before XML it was meaningful to prepare an entire PhD on communication between such platforms!

From this example, we see that every buzzword is said to solve all our problems. Few years later, the buzzword will just get deleted in favor of newer one. People need to understand the “concepts” behind the buzzwords not just how to use the tools and technologies related to them. He made fun of how people earlier earned so much money by writing about “Java & XML” when “Java” and “XML” were both buzzwords!

Patterns, Anti Patterns and Architecture

Getting more into the topic Mohamed asked the audience whether they know what patterns are. Well, few did! So, he explained “patterns” as solutions to common problems. He said that even architecture has much to do with this (more on that coming). Same as in building, there`re patterns in designing a living room or even a kitchen (like American furniture designs and such).

What happens is that someone faces a problem and solves it. Someone comes with better solution etc. and many people like it and repeat the same thing when solving the same problem. Someone draws UML diagrams and writes explanations for what the problem is and how the solution works, and this last work is what we call a pattern.

So, if patterns are the common practices we do to solve a repeated problem, then, following naming analogy, Anti Patterns will simply simply what what we should NOT do when soling our problems!

How about architecture? Lets use analogy with architecting buildings again. If a building buildings “designer” (similar to software designers) worries about the best use of spaces inside the buildings themselves, then the “architect” worries about the space “between” each building and the other, the green areas that should exist, where to have a garage, what ration should be between the building size and the width of the street it is build in, etc…An architect worries more about the interaction between systems and each other. Many applications have to talk to each other. Looking at a sample finance application, you may have an HR application that applies bonuses for example, for that, the HR application will have to talk to say a payroll financial application to apply the bonus payment.

But, not all applications run on the same platform, even more, each of them is likely designed in different way than the other. But we still need applications to talk to each others. That’s why we look at standard protocols, like HTTP, HTTPS and such. Those enable us to perform “integration” between those systems.

SOA, Who ??

SOA (Service Oriented Architecture) is an architectural style. What dos this mean? Well, back to buildings analogy. Mohamed showed pictures of example of Islam and Romanian architecture. All the audience could recognize each. The common parts in Islamic or Romanian architecture are what define an architecture style. The common parts between different architectures are what define the architecture style.

When you recall a 3-Tier architecture, you know what you are talking about, data access, business logic and UI. When talking about “Service” Oriented Architecture, you expect to see services.

What is the goal of SOA? Every architecture style has a goal. In buildings, why are the ceilings of the old houses very high? It was a pattern that solves a common problem. They no good fans or ACs back in that time, so, they made ceiling very high so that warm air goes up and less warm air remains in the normal height – to understand what the goal of SOA is, let’s get more on what SOA is.

SOA is an architectural style that emphasizes standards based integration between systems. This means enabling the components of different systems to talk to each other using standards. That’s one reason why WCF is good BTW, because it enables you to make components of the same system talk to each other in binary way, while still allowing components to talk to other components outside the same system using say XML. Clearly, this is not the easiest way to build applications nor one that guarantees success of the system. Not all applications should be built leveraging SOA, actually, trying to do SOA in all applications is a common mistake, Mohamed says. A Point of Sale (POS) application in a really small shop for example, has nothing t do with SOA.

Mohamed gave an example of Egypt back when there was no interaction between countries, all the goods are either made locally or very hard to get. Now, with all worldwide agreements, borders on getting and sending stuff are removed. SOA features standards: HTTP, SOAP, etc… It’s all about friction free interaction between different systems (again, standards based integration). It’s just a way of designing your application, a way of thinking.

Of course there’s lots of buzz/hype around SOA. You hear all that stuff about “Loose Coupling” and such. Some people might say applications should not not even know each other and have locators to tell them how to find each other. These are points of different opinions. Who said you need this overhead (or you don’t)? You still in all times have the overhead of translating from your internal system types and data to the standards format and the reverse overhead on the other system, so, if you are designing say a real time application with thousands of transactions in seconds, SOA will not work. If someone tells you 2e’ll go for SOA to improve performance, just tell him “you are so wrong”!

So, If I understood SOA is designing the system having services communicating with services of other systems using standard protocols like HTTP, and formats like XML, etc, etc… What is a “service” at all then? A service is an interface to your business process. When you are renewing your car driving license, you fill a form that is agreed upon between you and the responsible department, typically (does not quite happen in Egypt) you should be able to give it to only one terminal, without having to know say how many employees it goes to inside. This makes me personally think of a service as a method that will be called remotely with standards protocol and also parameters in standard format that a method caller should not worry about what the implementation of the method actually looks like.

The 4 tenets of SOA

By this we mean those tenets:

  • "Boundaries are explicit"
  • "Services are autonomous"
  • "Services share contract and policy not class"
  • "Service compatibility is about policy"
Boundaries are explicit

Mohamed showed a picture of a country border. There’s a fence, a STOP sign, a guy holding a microphone. If you are going full speed in the highway from Egypt to Libya, you have to stop at the border between the two countries (slows your total average speed). You also have to show say your passport and maybe visa (Authentication and Authorization). Services also have logical boundaries, could require authentication and authorization.

Also, when you re doing a money transfer from a country to another. you need to convert you local units in your country to the other country’s local units. For services, this is changing from the internal data types and schemas in your system to those of the system that has the service you want to connect to. Crossing the boundaries and doing the transfer takes time, that’s why we said that SOA is not the way to solve application slowness.

So, what are the boundaries of each service? We define that when we are architecting our services. We first agreed that those are logical boundaries. An example is, who should be able (and hence responsible) for changing a customer address? A sales application or a marketing application ? This is one kind of the questions we ask our selves when putting the boundaries.

Services are autonomous

If there’s a problem in having fish in Libya, should Egypt be affected by that? Of course no. Same with services. Each service should specialize in one operation. Services should be as least dependent on each other as possible.If service A depends on service B internally and for whatever reason service B is down, Service A should (ideally) still work with 100% its performance, or (more realistic) should provide downgraded performance. It should not be completely stopped.

Back to driving license renewal analogy. If the renewal requires getting your traffic offences, and those are got from say the ministry of justice that is down, it should tell you to come another day, or better off offers to give the renewed license to your house that other day. Note that “another day” is a degraded service.

The point is to make sure to not crash if the dependency is not found or down. Otherwise, a failure in one service, will fail all dependent services, that will cause failure to other services depending on them and so on, that you can easily find your entire company business down because of this.

Services share contract and policy not class && Service compatibility is about policy

The two are related. Back to countries analogy, to get the visa to travel from Egypt to Canada, you need to get police clearance(showing you are not a criminal). This is both a contract and policy. The contract is the police clearance certificate itself. The policy is that if the one applying is a criminal, s/he will not be allowed to get the visa.

For services, the contracts are the schema of data transferred between those services. The contract could be different from platform to another even when using standards. For example, if your service returns a customer record by sending a DataSet containing that record after applying XML serialization, the Java fellows trying to call your service will have hard time parsing the XML that gets generated from this serialization. Instead of that, you should send a typed Customer object XML document. A document that has the information needed clearly without any platform specific additional tags.

Policy is the protocol of the contract. For example, if the service requires authentication/authorization, works on HTTPS not HTTP or so, has certain timeout for results, etc… al this would be parts of the service policy. There’s an overlap between the policy and contract though (is the schema being XML or binary or what a policy or a contract?). In general, the policy is the definition of what’s allowed and required in the conversation between the service and its client (caller).

Thinking of contracts and policies, Mohamed showed that you should not require more data than you need. If your services just changes the address of the customer, it should require a “Customer Address” document not an entire “Customer” object document. This is called “Just Enough” Validation (MSDN). This is good also because the data is meant to come from a likely remote location, requiring less data will make things go faster.

One reminder on polices as well. This is like whether to use SSL or not, what protocol to go to, what to enforce, etc.. Mohamed mentioned the WS-* specifications that can give you in-the-box encryption, trust, transaction and other services, but there was no room to talk about WS-* here as we needed to move to the title of the session, SOA Anti Patterns ….

The Anti-Patterns

The session was originally called “Patterns and Anti Patterns of SOA”, due to time limitation, and prior permission from the dotNETwork guys, the session was split to two parts. One for the patterns, and one the anti patterns, which Mohamed has chosen to start with Anti Patterns as to clear up the thinking before telling us what we should be doing. He’s more interested in what SOA is NOT than what it IS. Let’s see what he talked us about…

Remember, this is what you should NOT do.

Anti Pattern: “CRUDy Interface”

OK, so we want to start SOA, and want to expose our system components as services. Let’s start by the easiest parts. Our system will always have to deal with Create (Insert), Read (Select), Update, and Delete operations (CRUD). Lets create services that encapsulate those – WRONG.

Changing a record can have so many side effects, let’s take an example of changing a customer address. This sounds very direct (update customer set address = …), and that’s it. Not really! If you change a customer address, many things could change as well. Tax rate for example. In Nasr City district in Cairo there’s some area called “Free Zone” or “El mantea’a El Horra”. If your business is in it, you’re exempted from taxes for certain years. If your business is anywhere else in Nasr City or Egypt in general you do not get that. So, changing an address from or to this area even still within Nasr city can have a big effect. Also, you may want to send an email to the branch that the customer will be transferred to when changing address, so, this is taking an action not just changing the address.

It happens in reality. If you change your address in the ID card, it does not affect your driving license, passport info, or bank account. Some guys came with an argument that it should, as al the systems should have the same database. Mohamed said that in reality we could have very good system for banking running ith IBM stuff, a good system for car licenses running on SQL server, while the ID system might be Oracle based. Because the systems are already packaged into different databases and database schemas, they just cannot share the same DB.

Anti Pattern: “Enumeration”

This means something like CustomerService.MoveNext();. A virtual curser  (meaning a pointer, not SQL curser). This allows the client to treat the data and iterate (loop) on them as if they were already loaded to the client, while they’re truly on the server. For the server to be able to enable this. It’ll have to hold the entire list for each client, and that would be a huge performance headache on the server, and the service should not have to worry about caching this and storing the last position and such. Remember (from the tenets) that services are autonomous. A service should care about one operation.

To explain this, Mohamed mentioned a system he joined in the past after it was created. There was too much work done on the DB server for updating recording dependant on each other and/or updating some complex calculations fields, etc.. This was done via SQL dynamic cursors. The cursors have been running all day locking the data in the DB from being accessed by any application.

The point is, the consumer (AKA client) of your service should not be the one who controls your server resources. You have no guarantee who’ll call the services. Even more, you have no guarantee who wrote the code that will call your service (even if you know which system it is via authentication), and you cannot guarantee whether they’re good developers or not.

Anti Pattern: “Chatty Interface”

This is when you require say 5 different service calls to do the same thing. Something like Customer.MarkForDelete(); Customer.Delete();. Two calls to perform deletion. This way you required the consumer to go all the way long from the client to your server and backwards two times instead of one. Well, not just that, how about if “MarkForDelete();” was called first and “Delete();” was never called??

This is actually something you may want to do in some certain cases, but most of the time you don’t. The problems with this are the additional time things will take to perform just one operation, and that it can easily get your data into an inconsistent state. If some of the steps were called and the next steps were for whatever reason not called, your system now has a weird state!

Anti Pattern: “Loosy Goosy”

Why don’t you just make all your services a single services that looks like XmlDocument PerformOperation(XmlDocument input) {…} ? BAD BAD BAD.

The point here is the difference between implicit and explicit behavior. If you do the example above, how would the clients know the way to call a certain operation than another? How will they know what data you need to be filled in the input XML or what to expect in the returned XML? An explicit behavior DOES matter. When creating your services, give them good names that shows what operation each service does perform. When defining your inputs, remember the “Just Enough” Validation rule. Make XML schema for the fields you need only better than using  a bigger XML schema that already exists. A services that updates a customer address only required a CustomerAddress document (With address and ID inside) not an entire Customer object document. You should also be explicit about what the service returns, whether nothing, a document with certain info, etc..

Why is implicit behavior bad anyway? Mohamed gave a very funny example.He went to work on an old COBOL based government system for salaries (salary laws were defined in 1936 and had endless changes afterwards all handled by this system),. The system was a single long routine with no modularity at all, and when trying to make it more modular, Mohamed got stopped at an entry point to the application that takes 3 flags.ZEFT (Asphalt), MIDO (fun name), SOSO (fun name). He couldn’t know what those 3 flags refer to until he asked the people using the system. They told him the woman who created this system has chosen MIDO as per the name of her son, SOSO as per the name of her daughter, and ZEFT (meaning asphalt) as per the name of  ….. whatever :D.

People kept  a notebook including what exactly the operations that are performed when you set ZEFT, MIDO and SOSO to certain different numbers. You can imagine what maintenance nightmare Mohamed found himself in, and this is exactly the nightmare you give your clients when you go for an implicit behavior. Mohamed says it’s like a house of dominos. It doesn’t survive long.

Last thing Mohamed mentioned was about the “Just Enough” Validation. What would you if your system earlier required a customer document with single field for address and now happened to have different fields (Line1, Line2, City,…). You then need to version your services. He showed how this can be done with XML serialization of objects. The main idea is you use your platform native types as long as you are inside the same system’s boundaries, and serialize/de-serialize that to/from different XML documents when returning/accepting XML data in your service. You can apply “version” and “optional” flags to allow versioning of the documents.

Just after the session, I asked Mohamed to show his Links slid, and guess what? He had my blog (with the old GeeksWithBlogs URL he likes more than this one) in his SOA recommended readings!!! I can’t pretend like I didn’t know it, having asked him for the references myself made it very embarrassing to me. But anyway, thanks a lot, Mohamed for this invaluable trust.

Conclusion

As I mentioned before, these are only the Anti-Patterns. The patterns are to come in the next gathering in July (God Willing).

Now to my comment: Mohamed did well for a guy explaining this to people who did not know what design patterns are. I’ve seen few advanced developers sitting in between and they were looking satisfied too. The microphone problem was a good thing for him. Everybody was happy, but for me, I was still missing some. Maybe that’s why he kept kidding with me about along the session “you feeling OK now, Meligy? :D :D” :D :D :D.

I didn’t like that he assumed SOA is all about SOAP and WS-* while other paradigms exist like REST and such, but I cannot blame him at all, as mentioning such would probably cause a huge disturbance to people and could simply get them completely lost. I also was sometimes losing the software example that maps to the building/countries/real-life examples he gave. That was in few cases though. Maybe I just wanted to hear so much technical stuff though! One more thing is that he had a very interesting flow of the talk that he could highlight and clarify a point either before or after its original place in the presentation. This didn’t cause people confusion, but it was really tiring when  came to transfer my session notes into this blog post, that I feel it does not tell the content of the session in a proper way.

Generally it was a very good session. If you could please people with different knowledge levels to good percentages in such a complex topic, then you have done something. Good job, Mohamed. You DID meet my expectations. I’ll be there for the Patterns session (God Willing).

BTW, Mohamed is now working on getting his VSTS related portal, theVSTSguy. I’ll update this blog as soon as he gets it up and running.

“Foundations of Programming, Building Better Software” is a new eBook by Karl Seguin. The book does not say in its introduction that it’s all ALT.NET-ish, it starts by introducing what ALT.NET is, it's goals etc, afterwards, all the topics the book covers are inspired by ALT>NET frequent topics. This includes Domain Driven Design (DDD), Dependency Injection (DI), Object Relational Mapping (ORMs), Mocking, etc…

Here’s what Channel9 had to say about it (which is how I originally found it too):

Karl Seguin recently released a great free 79 page eBook for .NET developers covering design patterns, unit testing, mock objects, memory management, object relational mapping, and more.  Get it while it's free!

Now, if I did my job well getting your interest, then you may want to get to the best part:

Foundations of Programming, Building Better Software – EBook Download

IF you’re not interested yet, I know this must get your most interest in the book, the table of contents (highlighting chapter titles in bold):

About the Author ...............................................................................................................................6
ALT.NET ............................................................................................................................................7
Goals .............................................................................................................................................8
Simplicity .......................................................................................................................................8 YAGNI............................................................................................................................................8
Last Responsible Moment................................................................................................................9
DRY ...............................................................................................................................................9
Explicitness and Cohesion ................................................................................................................9
Coupling ........................................................................................................................................9
Unit Tests and Continuous Integration .............................................................................................9
In This Chapter.............................................................................................................................10
Domain Driven Design.......................................................................................................................11
Domain/Data Driven Design...........................................................................................................11
Users, Clients and Stakeholders .....................................................................................................12
The Domain Object .......................................................................................................................13
UI ................................................................................................................................................15
Tricks and Tips ..............................................................................................................................16
Factory Pattern .........................................................................................................................16
Access Modifiers .......................................................................................................................17
Interfaces ................................................................................................................................17
Information Hiding and Encapsulation ........................................................................................18
In This Chapter.............................................................................................................................19
Persistence......................................................................................................................................20
The Gap .......................................................................................................................................20
DataMapper ................................................................................................................................20
We have a problem ...................................................................................................................23
Limitations...............................................................................................................................24
In This Chapter.............................................................................................................................25
Dependency Injection .......................................................................................................................26
Sneak Peak at Unit Testing.............................................................................................................27
Don’t avoid Coupling like the Plague ..............................................................................................28
Dependency Injection....................................................................................................................28
Constructor Injection.................................................................................................................28
Frameworks.............................................................................................................................30
A Final Improvement .................................................................................................................32
In This Chapter.............................................................................................................................33
Unit Testing.....................................................................................................................................34
Why Wasn't I Unit Testing 3 Years Ago?..........................................................................................35
The Tools .....................................................................................................................................36
nUnit .......................................................................................................................................36
What is a Unit Test ........................................................................................................................38
Mocking ......................................................................................................................................38
More on nUnit and RhinoMocks.....................................................................................................41
UI and Database Testing ................................................................................................................42
In This Chapter.............................................................................................................................42
Object Relational Mappers ................................................................................................................43
Infamous Inline SQL vs. Stored Procedure Debate ...........................................................................43
NHibernate ..................................................................................................................................46
Configuration...........................................................................................................................46
Relationships ............................................................................................................................49
Querying .................................................................................................................................50
Lazy Loading .............................................................................................................................51
Download ....................................................................................................................................52
In This Chapter.............................................................................................................................52
Back to Basics: Memory ....................................................................................................................53
Memory Allocation.......................................................................................................................53
The Stack .................................................................................................................................53
The Heap .................................................................................................................................54
Pointers ...................................................................................................................................55
Memory Model in Practice.............................................................................................................57
Boxing .....................................................................................................................................57
ByRef.......................................................................................................................................58
Managed Memory Leaks ...........................................................................................................61
Fragmentation ..........................................................................................................................61
Pinning ....................................................................................................................................62
Setting things to null .................................................................................................................63
Deterministic Finalization ..............................................................................................................63
In This Chapter.............................................................................................................................63
Back to Basics: Exceptions .................................................................................................................64
Handling Exceptions ......................................................................................................................64
Logging....................................................................................................................................65
Cleaning Up ..............................................................................................................................65
Throwing Exceptions .....................................................................................................................67
Throwing Mechanics .................................................................................................................67
When To Throw Exceptions .......................................................................................................68
Creating Custom Exceptions ..........................................................................................................69
In This Chapter.............................................................................................................................72
Back to Basics: Proxy This and Proxy That...........................................................................................73
Proxy Domain Pattern ...................................................................................................................74
Interception.................................................................................................................................75
In This Chapter.............................................................................................................................77
Wrapping It Up ................................................................................................................................78

The book cover has the www.codebetter.com URL, the community blogs whose owners originally started ht ALT.NET movement (I wrote about it very early back). I suspected it even before reading the table of contents!

Oh my. This is the book I always wanted to either read or write. Now I only have one option!!!

More Posts