Saturday, June 14, 2008

Demystifying the n-Tier Architecture (Part 2)

As you begin to develop your applications, hopefully you start with a design.   The reason I say hopefully, is because many programmers think that a design is a waste of time, rather just a point of documentation.   In reality, design is a vetting of the idea prior to laying the application or enhancement's foundation.

Image what would happen if the carpenters started nailing boards together before an Architect designed the house.  Would design or idea look like the as-built version? I am highly skeptical that they would.  Well, the same thing occurs when a programmer starts writing code before a design has been created.

Once the design is completed and there is a clear understanding of what is being done within the application synchronously, asynchronously, where the transaction boundaries are, and other non-functional requirements like response-time, up-time, among many others.

Now we are ready to start discussion of the Tiers.

Tier 1.  Presentation and UI

Presentation layer can take on many forms.   XML, HTML, PDF, Word, Silverlight, WPF, Windows Forms, Crystal Reports, Microsoft Reporting Services, are just some of the examples of the presentation layer.   Although it is an obvious portion of the application it is an important aspect that still needs an honorable mention.

Rules of implementing a good UI layer:

  • Should not bind to database statement directly - rather use business and data objects to shuttle the data between the UI and the database.
  • Should not implement any business rules - One of the hardest point for a developer to grasp, what is a business rule anyway? Well, the business rule is something that runs the logic that is specific to your line of business that ensures data integrity.  The motions of the UI (hiding and showing controls) are likely not considered a business rule.
  • Instant feedback to user - once a user action is taken the user is assured that "we are working on what you have just asked".  The "whiteout" effect of paused UI while stored procedure is running should be a thing of the past.
  • Validation - As much of the validation as possible should be done a the UI level.
  • Know Your User - Appropriate views - Often the application developers create functionality just because it is cool, it is important to understand your customer/user.  Cluttered display of information is just as bad as lack of information.

In the world where most things services have been made a simple commodity, it is the presentation and the personal touch that will create a point of "differentiation" for your organization.  Once that happens, everyone wins.  Your company grows market share, you get promoted, get a bonus.  Believe me, it is a win worth the time...

In the next part of the series we will attack the "Business Objects"

Max

"Inspire, Imagine, Innovate"

Wednesday, May 28, 2008

Demystifying the n-Tier Architecture(Part 1)

 

When it comes to good application design, separating the business logic from the UI is essential. It is true, splitting your tiers makes your application more testable, maintainable, and extensible.

A number of developers have come up to me to ask how to pass Entities (as in the Entities Framework) over web services, I began realizing that there are common misconceptions on what nTier ***really *** means for .NET applications and services...

This post is a part of a series that I am putting together to make Architects and developers understands the choices they make while realizing their designs.

The issue can be boiled down to misunderstanding the terminology of ported over from the Visual Basic 6 days and the good ol' days of ActiveX and DCOM where we have logical and physical definitions began to blur.

In the old days of Visual Basic 6 when we talked about good architecture, we considered packaging classes in a class lib, abstracting, and separating the UI from the business logic to be the good thing (and it sure was).   Inadvertently we have created a ActiveX library when all we wanted was to create a reusable components that could be separate but still part of the project, we now call them namespaces. The thing that made maters confusing is the fact that we could now take the same ActiveX and register it as a DCOM component, blurring the difference between between the logical design model and the physical deployment.

Unlike with the classics, ASP and VB6,  .NET brought the power back to the developers who are now able to virtually anything, anywhere in the code.  Which turned out to be good and bad (depending if you are wiring code, or fixing someone else's bugs).   Strongly-Typed DataSets, namespaces and assemblies, and a variety of options to from Web Services, to Remoting,  to EnterpriseServices became available to developers to realize their designs.  Understandably there is confusion.

There is a fundamental difference between the logical design, service orientation and physical deployment.

In the next few posts I will attempt to demystify what are the patterns that will benefit your application

Wednesday, May 14, 2008

Integrated Healthcare - Real Life

Many people tout the notion of integrated health care.   It is until you are faced with the challenges of taking care of those around you do you realize the benefits.

I had an unfortunate incident with my child take me all the way to Children's Hospital of Philadelphia (CHOP).  As a #1 Children's hospital in nation it is what a hospital should be.  A state of the art facility, where technology enables staff to do one thing, care for its patients.

As we were going through the motions of assessing the state of things in the ER, I began noticing how all of the systems were seamlessly working together,  the monitors, alarms, medications, X-ray machine, EMR, were humming together in unison.

Later as we moved to a patient room, it was clear that everyone WAS on the same page.   Doctors, nurses and other staff carried handheld devices that told them where they needed to be at any point in time by the "super computer" decision support system.

There we were in a state of being fully informed, content and calm.  We were visited by physicians, nurses, and other assistants that told us how things were, what is to come...  

If you think about it, not only this experience has made me a true believer that this was actually possible... I am sure that this experience is also saving CHOP considerable amount of money.  

The experience of being connected is not unique to just healthcare,  financial industry, homeland security, manufacturing and other industries may want to learn from what CHOP did to provide a fully integrated customer experience.

Thank you CHOP, for the service, the care, the experience.

Tuesday, April 1, 2008

Microsoft buys SpringSource - Or did it?

InfoQ article  reported that Microsoft is buying SpringSource for the sum of $1B.

Although there are sure to be mixed feeling about this in both the .NET and Java communities,  here are a few items of note to pay attention to when reading (or re-reading) the article and watching or(re-watching) the video:

  • Microsoft has made  a large investment into its own version of MVC framework, as well as development of Routing API.  Both items are equivalents of Spring MVC and Sptring WebFlow.
  • Article mentions that every windows install will be Spring Beans enabled.  Although Spring is a nice framework, there is little reason to install Spring Beans framework on every desktop.
  • Next version of Windows called SpringHorn".  No need to explain anything here, doubt that name would be approved by any marketing guys. (unless SpringSource buys Microsoft)

Knowledge is power.  If you take a careful look at the MIX 08 and other information being delivered as part of ASP.NET site, you will notice that this feels and sounds like a very clever April fools joke.

Although I have to say, weirder things have happened before (like Time Warner buying AOL)

 

Happy April!

Sunday, March 30, 2008

AJAX vs RIA's and Flash vs. Silverlight

In a question from the audience, I was asked to describe the differences between various technologies AJAX, Flex and Silverlight.

To start, AJAX is not a new concept, some of the elements such as the XML HTTP were available in very early versions of browsers.  That said, you needed quite a bit of skill to and effort to implement.  Specification and creation of JSON and WSDL have helped to mature this technology and actually make it not "rocket" science to implement.

AJAX vs RIA

Comparing these is quite difficult and full of debates, but here are a few items of note:

AJAX Pros

  • does not require any browser side plug-ins to work
  • Cross browser capable
  • Server-platform neutral
  • ASP.NET provides a fully integrated developer experience
  • provides enhanced user experience.

AJAX Cons

  • cross browser behavior is complex, new features and browser caps change with every version.
  • very limited local storage (using cookie only)
  • no pixel level support
  • other IDE behaviors is not
  • Limited mobile support

RIA Pros

  • Rich and sophisticated user interface possibilities
  • local and disconnected state
  • network API (other than HTTP)
  • Extensive development environment and debugging

RIA Cons

  • rich graphics still require work from designers
  • requires an browser plug-in
  • Network download is sometimes large

With all things considered, there are pros and cons how each technology can applied. As such, it is important to understand the business requirement and strategy when making these choices.

I my humble opinion, RIA represents the next evolutionary step of user interfaces for the web, mobile and other alternative user interface technologies to desktop.

Flex/Flash vs Silverlight  or RIA's

Flex and Silverlight are a new generation of technologies that we have began to commonly refer to as Rich Internet Applications or RIA technologies. 

Today there are a few choices when you develop RIA applications.  You can use Flex to develop Flash based RIA's, or Visual Studio 2008 can be used to develop Silverlight applications.

In an effort to not say what have already been said, a few months ago as I was doing some evening reading, I have stumbled upon a very interesting (although lengthy post) which compares the two technologies.

http://silverlight.net/forums/p/634/1076.aspx

This is a fantastic post, in part because it provides great detail regarding both technologies but also because it is being responded to by evangelists from from Adobe Flex team and Microsoft Silverlight.  The initial question as you can see came from a regular developer, but the conversation quickly turned technical and non-hostile from both specialists covering the technology.

An absolute great read....

I am a huge proponent of app lifecycle, developer capability and platform maturity.  That said, when you compare technologies to be used on the project, you need to take into consideration how many times will the developer be switching between IDE's to accomplish a maintenance task.

Switching between different applications for the development causes a shift in context and a loss of focus... which ultimately translates into loss of productivity.  Usage of multiple development environments also causes fragmentation in the upgrade and maintenance cycles.

Microsoft has the made the winning decision here by allowing the developer to concentrate on a single IDE with a single technology (.NET) that can be used both in the client and on the server.  This is not the case for Flash/Flex combo.

 

I3 =  Inspire, Innovate, Implement.

Tuesday, March 18, 2008

SQL Server Data Services (SSDS) - a powerful proposition...

As most of the attendees would agree, I can honestly say, information presented at MIX08 was very powerful.  From the announcements, to keynotes, to sessions it is really tough to say what created a more powerful message.

Many blogs have written about the nice bits announced at the MIX such as IE8, Silverlight Mobile, Silverlight 2.0 Beta, among others.   The session that was not given high level of attention, the SQL Data Services sent a really powerful message.

"WHY?" you ask, I look at the world as an architects' buffet.  Choices are about, from Sliverlight and Flex, WinForms or ASP.NET, OBA vs VBA.  The point is, anywhere you look you have choices that really make up the alphabet soup we call Application Architecture.  

So reason with me for a moment, lets say that you are choosing your next best platform for your business. You are inevitably faced not only with technical choices, but also with realities of the business (otherwise known as time-to-market and financial constraints) that cause you to make hard and careful decisions.  The business exec tells you that he is forecasting organic growth and adoption, but can't really pin-point how much or even how fast.

As a person of reason (which most Architects are), that kind of problem would make you think "Lots of hardware, fully distributed, redundancy in all places".  While that kind of quick thinking works for web and app servers, database scalability and management created a larger and more complex set of problems. So there you are arguing that you need $200K in hardware and infrastructure prior to making even a single dollar of sales revenue.   Interesting to note that many business execs have a hard time parting with their money prior to some assurance that what you are delivering will work and scale to their SLAs.

(Note: if $200K does not strike you as much, make it $2M to make it a better point)

Here comes the SQL Server Data Services....

Architects, as do business managers like to play out the what-ifs.  There are a number of "what ifs" examples, lets take a look at a few:

  • What if you could decide how and when to start hosting your own infrastructure?
  • What if you could decide to save your money and not hire a DBA, or get a SQL license, or worry about backup and redundancy?
  • What if you needed the kind of capacity that is nearly impossible to provide for a fixed budget as it is not getting used all year long (think seasonal load, Shopping trending in Dec, or Tax Jan-Apr)
  • What if you could bet on a platform that removes the risk of paying up front just in case it does not pan out?
  • What if you wanted to have your data geographically co-located for faster access?

These are just some of the ideas that are going to be possible with the SQL Server Data Services.

Microsoft has long been a leader in redefining what the “ultimate development experience” is.  This has been proven again, and again, and again (this time with with VS 2008). 

There has not been as much fanfare on the Data side of the isle since the introduction of Strongly Typed DataSet, but technologies such LINQ, ADO Entities and SSDS are set to redefine how developers interact with data.

From my perspective, we are at the dawn of next generation of architectures that will bring incredible possibilities and limitless potential. 

This will truly revolutionize how developers perceive data connectivity and availability, how applications work with data, and how end users will be empowered by the new breed possibilities.

Saturday, February 23, 2008

ASP.NET Dynamic Data

Back in May 2006 Microsoft introduced a pretty cool sample application called BLINQ.  As the sample description mentions:

"Just point Blinq at a SQL database and it will create a web site with pages that display sorted and paged data, allow you to update or delete records, create new records, and follow relationships between tables in your database".

Over the months that followed and I know that many have waited to see where this sample application and technology will go.  Months became years, but what can I say, the wait was well worth it.

Recently the ASP.NET team introduced a very cool technology called ASP.NET Dynamic Data, the concept that most of applications are simple CRUD applications is key to understanding the enormous benefits of  this ASP.NET 3.5 Extension. 

Developers creating applications using ASP.NET should take a very serious look at this technology as it will save them countless development hours.

 

Remember, the line you did NOT write does not contain a potential bug.

;)

Thursday, February 21, 2008

Common Performance Hurdles

I have been asked numerous times to review application design and/or implementation due to lack of desired performance.

More times than not, the issue is not within the .NET code itself, rather in the misuse of the View State or the session variable.

Remember that performance of a ASP.NET page is not merely the time it takes to render controls (HTML, JS, CSS, etc...), it also includes the time it takes to send the bytes and bits over the wire.

Dave Reed has a fantastic post on how to properly use the View State

Check it out in this post.

http://weblogs.asp.net/infinitiesloop/archive/2008/02/19/truly-understanding-viewstate-comment-index.aspx

Mike Voldarsky wrote a good article a few years back on the Session State.  You can find that here:

http://msdn.microsoft.com/msdnmag/issues/05/09/SessionState/default.aspx

Wednesday, February 20, 2008

Client Product Roadmap Announced

In his latest post Scott Guthrie discusses the enhancements to the desktop platform.  These new enhancements will be good news for many of the developers targeting the desktop.

http://weblogs.asp.net/scottgu/archive/2008/02/19/net-3-5-client-product-roadmap.aspx

For those who did not make the connection (or just may have forgotten), there is an ASP.NET Web Road Map that Scott has published back in November.

http://weblogs.asp.net/scottgu/archive/2007/11/29/net-web-product-roadmap-asp-net-silverlight-iis7.aspx

These are a must reads for the developers and architects targeting these platforms.

Friday, February 15, 2008

Microsoft Releases .NET 2.0 SP1 and .NET 3.0 SP1

Last week Microsoft released two service packs for the 2.0 and 3.0 versions of the .NET framework.   Download links did not contain the details (or it was not apparent) as to what was fixed so I thought I post it here for anyone who is interested what issues have been addressed:

 

.NET 2.0 SP1

http://support.microsoft.com/kb/945757

.NET 3.0 SP1

http://support.microsoft.com/kb/945826/en-us

 

To Download these SP1 you can use Windows Update or the links below:

.NET 2.0 SP1

http://www.microsoft.com/Downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&displaylang=en

 

.NET 3.0 SP1

http://www.microsoft.com/downloads/details.aspx?familyid=EC2CA85D-B255-4425-9E65-1E88A0BDB72A&displaylang=en

Saturday, February 2, 2008

ADO Entities - The new beginning....

 

As a developer you are (most likely and definitely hopefully) eager to use tools that will get you recognized as the one who stands out from the typical developer.  You strive to be better at what you do by following known, well defined and proven patterns. You reach for the tools to make your solutions more predictable.

This was relatively easy in most of the facets of application development, until it came to changing schemas and other database related areas.  You have stared the DBA's in the eye and at some points prayed that the changes they are making would not cause you undergo a full rewrite or a substantial tear-down of your application.

While you hoped and prayed, ADO.NET team has listened to your prayers and released a very slick framework called ADO Entities and an ADO Entity Designer (aka Astoria). 

This is truly a new and very nice beginning.  Imagine the new world where:

  • DB Schema can be exposed as objects
  • those objects are actually defined as a Model to your application and not just straight schema map
  • those objects can span (use multiple tables to store/read info)
  • or tables can be merged into a single object
  • objects collections can be used in a JOIN and other LINQ related operations
  • lazy load and concurency  is no longer your issue
  • compiler will let you know if the column name exists
  • you no longer have a need to write or maintain complex DAO layers

Well,  that world is here now...

Currently in Beta 3 this is a nice set of tools to be adding to your developer toolbox. 

Join the excitement and start exploring the new and wonderful world of ADO Entities.

http://www.microsoft.com/downloads/details.aspx?FamilyId=15DB9989-1621-444D-9B18-D1A04A21B519&displaylang=en

 

Enjoy and be sure to let me know what you think....

Friday, January 11, 2008

Speaking At CodeCamp 2008-1

Come and see 55 passionate people speak on technical topics.  There sure to be a topic for everyone from developer to manager to just plain tech junkie.

The meeting is being organized by the Philly.net user's group. 

Check out the agenda, speakers and other interesting stuff

http://www.phillydotnet.org/Meetings/MeetingEmails/2008/January122008/tabid/603/Default.aspx

 

If you are interested in joining the group, or interested to speak at future events click on the link below.

http://www.phillydotnet.org/

 

Max

Thursday, January 10, 2008

The Inaugural Post

My name is Max Zilberman and I am currently a Enterprise Software Architect for a Fortune 100 company. I have been doing .NET all the way back when no one really understood what .NET really was. To be precise, I started with the Beta 1 of 1.0 and never looked back since.
Other the years, I have been asked a number of different questions on technical topics, some that have been technically inspiring to learn for my self, others that are fun to answer and write about. I am hopeful to use this blog to talk and discuss various topics including Software Architecture, .NET in the Enterprise as well as down to earth topics that are just plain cool.
I have recently received a question that was cool to answer using complete sentences and not just a blurb fired back:

"I've been learning C#.Net and I'm hoping you can provide some insight on something: I've heard that there are some applications that are currently in C and need to be upgraded .Net. At the am I correct that the Developer would have the choice to pick (or at least recommend) the .Net
language as either VB.Net or C#.Net. Can you think of any reason why it wouldn't logically go to C#.Net. Am I also correct that C is a subset of C+ which is a subset of C++ which is a subset of C#, which is a subset of C#.Net? Are all C# versions various releases of .Net?"

 

Now for my answer:


Let’s start with some language history and background on your questions below:
C – as a language has been introduced in the early 70’s as a way to empower the developers to develop the way they want, and also get very good performance. The actual intention of the language was to do system level programming on Unix OS. One of the first compilers (I believe) was done by Brian Kernighan and Dennis Ritchie at Bell Labs and to this day their book remains a classic reference (although I think it is a bad book to learn from, it is good reference). C in itself is what is called a “imperative, functional language” meaning it does not support objects (but it does support object like structures called: “struct”). C was and is one of the most powerful languages around because of its simplicity to learn and the power of the simple libraries that come with and relative interoperability on different OS’s
C++ - was created by the father of C++ Bjorn Stroustrup. Actually the first C++ compiler was nothing more than just a pre-processor to C. Although you can program in C and compile with C++, at the core if you are doing C++ you are really not doing C. Most things are different including, declaration, object notation, passing by val or by ref, method declaration among a notable few. C++’s power is speed, Most applications that require “cycle counting” performance will most likely be done in C++. For example, although Microsoft created .NET, the entire Visual Studio (with exception of some add-ins) is done in C++. The downfall of C++ is its complexity in its notation and memory management. In the interview given by Bjorn about 5 years ago, he mentioned that initially memory management (what we know as Garbage Collection) was part of the language spec, however it was removed because overhead of that processing was very high and computers were not as powerful as they are today.
C# - C# is one of over 20 languages that are now part of the .NET Languages. The simplicity of .NET is that memory management is done for you. Although many say that VB had that from beginning, VB never had the power of inheritance, memory mapping, type safety and many other aspects that are today very natural and native in ..NET. C# has pointers just like in C and C++, but uses for them are very sparse for a general developer. C# has both the benefits of .NET and the elegance of C/C++.
In .NET, the intent of the language is to describe the semantics of the intent, but not the specific code for execution. To be clear, when one writes in .NET what the compiler is doing is translating the C# (or other) code into an executable language called MISL (pronounced missile). MSIL is what is actually executed when a .NET program runs. There are provided tools like “Reflector” by others, that are able to translate MSIL into any language in .NET, thus if the code was originally written in “managed C++” it can be simply viewed as VB.NET or vice versa. (this is called “intent to code” or “intentional programming”). To date there have been 3 specifications of C# (all of course are part of .NET) and the differences are just syntactical (even IL is the same).
For an example we can look at a the change from C# 1.0 and 3.0 for "property declarations":


In 2.0:

public string _firstName = "";
public string FirstName
{
get
{
return _firstName;
}
set
{
_firstName = value;
}
}


In 3.0, C# team realized that most of the properties look alike and make a short hand notation:



public string FirstName { get; set; }



It must be noted that this is a single example among any other language improvements since the C#1.0, all (most if not all) of the syntax from C#1.0 is compatible with the newer specifications.



Now onto your actual question:



The performance has very marginal differences when one chooses to program in VB.NET over C#, however from a style and readability perspective C# wins because of smaller and fewer keywords to describe a statement. There ARE sure differences in the IL that is being produced because the compilers are different, but in the end those differences are very minor.



Having spoken to developers at other companies, most write C#, when they write ..NET code. C# would be my language of choice as well.



That said, it is VERY important to consider the capabilities and willingness to learn for a given development team, and in the end if the decision to choose VB.NET due to the overwhelming majority of programmers who grew up with VB6.  Then that is the right decision



I hope you enjoyed reading this as much as I enjoyed writing it.





MZ