In principal, despre .NET, VB6. C#,VB.NET, ASP.NET Apoi despre programare si multe alte chestii ... de programare.

Subscribe RSS   Mini tools List

sâmbătă, martie 31, 2007

Va rog sa folositi acest URL NOU de la

Am terminat cartea de Refactoring de Martin Fowler
(multumesc de 2 ori, Somalezule!)

Ce mi-a placut cel mai mult:

Introduce Null Object
if (customer == null) plan = BillingPlan.basic();
else plan = customer.getPlan();
Ron Jeffries
We first started using the null object pattern when Rich Garzaniti found
that lots of code in the system would check objects for presence before
sending a message to the object. We might ask an object for its person,
then ask the result whether it was null. If the object was present, we
would ask it for its rate. We were doing this in several places, and the
resulting duplicate code was getting annoying.
So we implemented a missing-person object that answered a zero rate
(we call our null objects missing objects). Soon missing person knew a
lot of methods, such as rate. Now we have more than 80 null-object

Separate Domain from Presentation
If you have a grid, create a class to represent the rows on the grid. Use a collection on
the domain class for the window to hold the row domain objects.
( asta cu griudul nu o faceam intotdeauna- se potriveste cu ce zicea Lhotka: ok to duplicate fields, not ok to duplicate behaviour)

Post page:

Weblog post by 'admin' on 'refactoring'



Trimiteți un comentariu

Links to this post:

Creați un link

<< Home

Acest blog s-a mutat la