refactoring
Va rog sa folositi acest URL NOU
de la
http://serviciipeweb.ro/iafblog/
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();
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
classes
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
classes
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.
the domain class for the window to hold the row domain objects.
Post page: http://serviciipeweb.ro/iafblog/2007/03/31/refactoring.aspx
Weblog post by 'admin' on 'refactoring'
Categories:.NET;carti;programare
0 Comments:
Trimiteți un comentariu
<< Home