Speaker: Rockford Lhotka
Most important things heard today:
N-Tier is not the same as N-Layer.
N-Layer is always good, especially to structure your code, which makes it maitainable. N-Tier involves a process-boundary, or even a network boundary. Therefore a tradeoff must be evaluated from the following:
- Fault tolerance
Formula to calculate the Concurrent Transactions Per Second (ctps):
ctps = (NrOfUsers / UserThinkTime) * TransactionDuration
Split up Business Logic Layer in Client and Server.
In order to use business logic close to the UI for a rich UI feeling and close to the data layer for multi-object logic, one could split the business layer.
The splitted layer could be conneced using a DataPortal, which encapsulates the underlying mechanism (Remoting, WCF, Webservice, etc) of transfering the business objects from the client to the server and back. The DataPortal is an implementation of the Channel Adapter Design Pattern.
Using event and (binary) serialization.
Be careful with events and serialization, because you might serialize more than expected, depending on the serializer being used. Serializers that serialize (private) fields will also try to serialize the class that has an event subscription on the class, because it's referenced in the list of subscribers. 3 possibilities from here:
- This is planned to happen.
- This is not planned, but the subscriber class is serializable. This results in a larger performance and/or memory footprint hit, then expected.
- This is not planned and the subscriver class is not serializable. This will result in an exception being thrown.
Solution for preventing the subscriber class from being serialized is to implement your own implementation of AddHandler, RemoveHandler and RaiseHandler.
The CSLA Framework.
"Rockford Lhotka’s CSLA .NET framework is an application development framework that reduces the cost of building and maintaining applications.
The framework enables the use of object-oriented design as the basis for creating powerful applications. Business objects based on the framework support many advanced features to simplify the creation of Windows Forms, Web Forms and Web Services interfaces." (copied from CSLA website)
The CSLA Framework combines (when needed) the best of object orientation and databinding, by providing a set of base-classes for objects that already common functionality for implementing IBindable.
Als it provides a method for defining Validation and Authorization rules. One can add (static) methods that add rules to a rules collection. For Authhorization each getter, setter and method must start with an additional call to a generic validation method to determine whether the current user may access the getter/setter/method in question. For Validation the setter must add an additional call to a generic validation method. Important here is that a "bad value" must be accepted and no exception may be thrown. The databindable components or errorprovider must examine an object to determine whether it has valid values for each property.
This framework could really enforce a jumpstart when implementing an object oriented design, that needs to be coupled preferably by standard .NET databinding.
LINQ, Language Integrated Query.
LINQ is a Microsoft Project that adds a native quering syntax to .NET Framework programming languages, therfore reducing the roughly 20 lines of code needed to fetch data back to 3 lines.
Additional CSLA resources: