Está en la página 1de 4

Key words: Security, performance, maintainability, decoupling (loosely/tightly coupled), reusable,

extend
Telerik: productivity, ASP.NET includes a GridView control that works well for simple presentations of
tabular data, but lacks common features like filtering and grouping. The default controls can be
extended, but the process is time consuming and counter-productive for most projects.
UI for ASP.NET AJAX from Telerik, for example, offers over 80 UI controls for rapidly building
ASP.NET and SharePoint sites and applications enabling you to focus on value-generating development
tasks and reduce time spent on common application functionality.
The Toolkit adds simple AJAX behaviors to ASP.NET applications.
CSLA.Net (Component-based Scalable Logical Architecture): helps you build a reusable, maintainable
object-oriented business layer for your app. this framework reduces the cost of building and maintaining
applications.
Simplifies and standardizes implementation of business logic, validation and authorization logic within
your objects.
The goal is to provide an easy and consistent coding pattern by which you can encapsulate all your
business logic within your object-oriented business layer. The result is a business layer that can support all
the interface types listed above, while remaining decoupled from any specific interface technology.

Data creation, retrieval, updates, and deletes (CRUD) are performed by clearly defined methods of the
business object associated with the data testing. Data access logic is clearly separated from business logic,
typically using a repository pattern or other mainstream object-oriented programming techniques.
Code Generator: Reduce boring repetitive coding tasks so you can focus on important things and help you
work get done in less time. Generate high quality code in less time with fewer bugs. Produce consistent
code that adheres to your own standards. Easily create custom templates to output source code for any
programming language. Code generator comes with useful sample and templates such as CSLA, PLINQO.

Polymorphism/Interface/Abstraction
Polymorphism (many change): object on runtime can point to many instances during runtime which it
has inherited from. So, depending upon situation objects can change its behavior i.e. objects act
differently under different conditions. Polymorphism is the fundamental thing to achieve decoupling.
Interface: The main goal is decoupling with the help of Inheritance and Polymorphism.
Abstraction: Dont want clients to reference to strongly typed classes/object. Eg: Customer class has
many different types like SimpleCustomer, DiscountedCustomer etc. There classes can be consumed
from 10-15 clients where you would want to make changes in only 1 place. So, instead of referencing
Customer, you need to reference to ICustomer through( eg: Factory class) Factory will inform all the
consumers. You can make 1 change only in factory class. Clients will refer to this factory class.
RIP pattern => Remove your if condition with polymorphism.
# var vs dynamic: var is statically typed (early bounded) and dynamic is late bounded or checked on
runtime (dynamically evaluated). Compiler will figure out the data type.
Eg: var x = string1; int len = x.Length; //intellisence shows Length property already
Dynamic y = string1; int len = y. doesnt know Length property exist

# yield keyword: helps to do custom stateful iteration over a collection without using a temporary
collection. (When to use: lazy loading, return infinite sequences/random sequences and all sorts of novel
enumerations that would either be extremely inefficient or impossible to do with the model of creating a
list first, traverse file sysetem)
The control moves back to the caller. The caller
then captures the value, it then reenters into the
source (function) and captures that value and
goes back to the caller and returns it. In other
words, when the control moves back and forth
from the source to the caller and caller to the
source. It saves the state.

Events and Delegates:


A mechanism for communication between objects : when something happens to an object it can
notify other objects. Why do we need to notify? Because it can help build loosely coupled
application.
Used in building loosely coupled applications: An application that its components or classes are
not tightly coupled together.
Helps extending applications: Loosely coupled applications are easy to extend without breaking
or changing its existing capabilities.
public class VideoEncoder
{
public void Encode(Vide video)
{
//Encoding logic...

_mailService.Send(new Mail());

_messageService.Send(new Test());// if we add extra line here this Encode method is changed
} // which means this class has to be recompiled and so do other classes
} // that are dependent on this class has to be recompiled and redeployed

We want to design our application in such that when we change application, that change has minimum
impact on the overall application. We can use Events to resolve this problem.
VideoEncoder MailService

Publisher (event sender) Subscriber (event receiver)

VideoEncoder knows nothing about MailService which means in the future if we want to extend our
application and add capability to send the text message when the video is encoded, we can simply create
a new class MessageService and have it subscribed to that VideoEncoded event of the VideoEncoder. So
basically VideoEncoder does no need to be recompiled and redeployed. We simply extend the
application by adding a new classes. The compilation time would be reduced and application could be
redeployed without breaking along the way.
public class VideoEncoder
{
public void Encode(Vide video)
{
//Encoding logic...

OnVideoEncoded();

}
}

So, how does the VideoEncoder notify the subscribers?


It needs to send message to them. In practical C# terms, it means invoking a method in the subscriber.
But, how does the VideoEncoder knows what method to call? For that to happen, there needs a contract
or agreement between publisher and subscriber that both agree upon (aka Delegate) i.e. a method with a
specific signature.
So, we need to have that method in MailService and MessageService. So, when the VideoEncoder raise
that event, its going to call this method. VideoEncoder does not know about the existence of
MailService or MessageService. Its decoupled from them. All it knows is a method. So, how do
VideoEncoder knows what method to call, thats when delegate comes in.
Refer to EventsAndDelegates project for more information

También podría gustarte