Andrew Filev

Yet Another .NET Blog

PetShop 3.0. Design patterns????

Recently my MSDN RSS feed announced me new version of .NET PetShop. The article tells us that PetShop was refactored for better architecture.

I was so curious, that I have downloaded PetShop installer and gave it a try. I am rather disappointed with its architecture. I am not telling that PetShop's architecture is bad. IMHO architecture can not be good or bad, but it may suite several requirements better or worse.

Current PetShop implements every type from conceptual model with the use of six classes from six projects (BLL, DALFactory, IDAL, Model, OracleDAL, SQLServerDAL).
I think you can estimate the cost of change in domain field. If you change one type, you will be obliged to change six classes.
You can also estimate the amount of work, which is required to add additional database layer. To add additional database you need to create NewDBDAL from the scratch, and you also need to extend DALFactory.

There are different ways to map relational data to objects. PetShop v3.0 is using Table Data Gateway. This at least doubles amount of classes, required to implement any domain field type. This is not good or bad, let's take it as a fact. How could we refactor current app and make it more extensible still using this pattern?
I would advise using Bridge pattern and implement DAL classes as one class instead of two classes and one abstract interface. This way we could separate DAL interfaces and algorithms from concrete database implementations. Later, when we decide to add support for additional DB we won't be rewriting DAL from the scratch we will just add additional implementation. We will also be able to reuse those implementations in our future projects, while current DAL has nothing to reuse if the project is not related with PetShop.
Another issue is BLL/Model. What's the benifit of splitting every class into two ones, one for behaviour and another for data?

Unit tests.... If this application is considered to be a good learning example, I think it should include unit tests at least for the business logic.

Comments

eastspider said:

if the DAL has 500+ methods,it's diffcult to maintain if follow the beidge pattern

wohuosile@hotmail.com
# January 7, 2004 4:36 AM

TrackBack said:

^_^,Pretty Good!
# April 9, 2005 6:25 PM

wholesale caps said:

I recently came across your blog and have been reading along.

# July 23, 2011 3:10 AM

designer bags said:

this is a fabulous idea to use the fabrics as sentiments on buttons.<a href="www.buy-designerbags.com/" title="designer bags">designer bags</a>

# July 25, 2011 10:26 PM

supra tk society said:

You managed to hit the nail upon the top as well asand alsoand defined out the whole thing without having side effectside-effects , people cancould take a signal. Will likelyprobably be back to get more. Thanks!<a href="www.supratksocietysale.com/" title="supra tk society">supra tk society</a>

# July 27, 2011 10:39 PM

Abercrombie outlet sale said:

oh, Great articl! I will keep this post.<a href="www.abercrombie-outletsale.com/" title="Abercrombie outlet sale">Abercrombie outlet sale</a>

# July 28, 2011 8:51 PM

cheap Chanel bags said:

One is always on a strange road, watching strange scenery and listeningto strange music. Then one day, you will find that the things you tryhard to forget are already gone.<a href="www.cheapchanelbags-outlet.com/" title="cheap Chanel bags">cheap Chanel bags</a>

# July 28, 2011 8:55 PM

moncler down jackets said:

Great blog. There's a lots good data in this blog, though I would like tell you something.<a href="www.monclerdownjacketsuk.com/" title="moncler down jackets">moncler down jackets</a>

# July 31, 2011 9:57 PM

cheap Burberry outlet said:

Easy option to get useful information as well as share good stuff with good ideas and concepts.<a href="www.cheap-burberryoutlet.com/" title="cheap Burberry outlet">cheap Burberry outlet</a>

# August 1, 2011 2:26 AM

Abercrombie outlet sale said:

I am really appreciative to the writer of this post for doing this fair and informatory article here for us. We really appreciate ur attempt. Keep up the charming process.<a href="www.abercrombie-outletsale.com/" title="Abercrombie outlet sale">Abercrombie outlet sale</a>

# August 1, 2011 5:22 AM

Ralph Lauren outlet said:

The information provided by the author is really helpfull .i will recomend my collegues to vist the blog.<a href="www.ralph-laurenoutletonline.com/" title="Ralph Lauren outlet">Ralph Lauren outlet</a>

# August 2, 2011 11:18 PM

Cheap Timberland Boots said:

Hey this is really nice information. I was looking for something similar like this. Thanks for this useful information.<a href="www.cheap-timberlandbootsoutlet.com/" title="Cheap Timberland Boots">Cheap Timberland Boots</a>

# August 4, 2011 11:17 PM

belstaff leather jackets said:

Thanks for sharing. i really appreciate it that you shared with us such a informative post.<a href="www.belstaffleatherjacketsuk.com/" title="belstaff leather jackets">belstaff leather jackets</a>

# August 6, 2011 2:57 AM

Wholesale Caps said:

Interesting posts here.. gracias for sharing so much in your blog.. Greets.

# August 10, 2011 5:37 AM

buy designer handbags said:

Hey this is really nice information. I was looking for something similar like this. Thanks for this useful information.<a href="www.buy-designerhandbags.com/" title="buy designer handbags">buy designer handbags</a>

# August 11, 2011 9:44 PM

cheap Chanel bags said:

Well, I love to leave this comment and share with you about this. Thanks.

# August 11, 2011 10:29 PM

Nike Air Max 2011 said:

Easily, the post is really the greatest on this laudable topic. I concur with your conclusions and will thirstily look forward to your future updates.<a href="www.2011nikeairmaxsale.com/" title="Nike Air Max 2011">Nike Air Max 2011</a>

# August 11, 2011 11:11 PM

Birkenstock sandals said:

I wanted to thanks for this great read!! I undoubtedly loved every little little bit of it.<a href="www.birkenstocksandalscheapsale.com/" title="Birkenstock sandals">Birkenstock sandals</a>

# August 13, 2011 4:41 AM

Cheap Supra Footwear said:

Easy option to get useful information as well as share good stuff with good ideas and concepts.<a href="www.supratksocietyblue.com/" title="Cheap Supra Footwear">Cheap Supra Footwear</a>

# August 17, 2011 8:26 PM

cheap north face jackets said:

I continue to read blogs like this, because I am trying to better my ability to write great content, this is an awesome example.[url=www.cheapnorthfaceoutlets.com]cheap north face jackets[/url]

# August 19, 2011 4:51 AM

tryecrot said:

Yes there should realize the opportunity to RSS commentary, quite simply, CMS is another on the blog.

# August 29, 2011 4:15 PM

Monster Energy Hats said:

I'm so interested in this topic. It's very informative.

# August 31, 2011 2:25 AM

cheap Prada handbags said:

I read this informative article and I really enjoy reading it. I hope see more articles on this topic by you soon.

# September 17, 2011 3:36 AM

Red Bull Hats said:

I came to your article from another article and am really interested in this learning about this

# October 11, 2011 4:35 AM

Moncler Clothing said:

Cheap Moncler clothes stops the

# November 5, 2011 1:58 AM

xinchen1002 said:

The sunshine with the window come in, tilted in not as the walls Moncler Karak of the paint. "Is this the first time you?" Litchi light asked. "Well, no." XuHuan low head gently said. "Ha ha ha, really?" Litchi gently smiled asked. "I, every day I do!" XuHuan staring at looking at litchi said. "Look at you all of the bearded grow out, I like you smooth young Moncler Leon elastic skin!" Litchi said with a smile. "I also like you!" On the wall of the lychee from mattress stood to wear clothes, XuHuan suddenly from Moncler Maya the lychee behind an embrace liu li. "Ha ha, today we have enough, you also should go to school!" Litchi look down at around in his dancers double arm said. "Can't we once again!" XuHuan posted in the face of litchi waist, with light yellow beard rubbed Moncler Menuire litchi skin asked. "That you said to me, this is your first time!" Litchi turned, stick on the face of XuHuan Moncler Opaque little stomach, crooked asked. "I'm not saying yet, I do every day.!!!" XuHuan looked up at litchi said. "I said is not * * *!" Litchi her hands cupping her XuHuan face said. "Well, about the first time, because and girl twitched!!!!!" XuHuan shy of Moncler Opaque say that finish, loosen the embrace of litchi, heavy and leaning against the wall. "After we can't socialize!" Litchi smiled at the XuHuan said, tone, and with the meaning of the Moncler Pyrenees guilty. "Why?" XuHuan stood up suddenly, both hands grabbed litchi shoulder anxiously asked. Lychee is simply look at XuHuan smiled, and gently shakes his head no longer speak. "I don't part from you!" XuHuan language take cry adjustable looked at litchi, look in Moncler Chartreuse the eyes with endless perseverance. Before looking at the big of litchi boy, in the heart also have endless shed, but she XuHuan ten years older Moncler Chaumont than the whole, and XuHuan this year was only 17 years old, the combination of them is not to be allowed by the ethics. Litchi stretched out on XuHuan around the waist said, gently will face on XuHuan strong chest muscle, tears suddenly stood. "This year you was an adult, and I'm older than you for ten years old, in the eyes of others, I was not Moncler Eric a good woman! You and I together will destroy you!" Litchi, with tears in XuHuan to said. "I don't care, as long as I with you!!!!!" XuHuan tightly embrace litchi, want to melt into his body lychees. "You are now small, wait till you get old, you will abandon me!" Back XuHuan arm litchi pushed said. "I don't abandon you, any time don't abandon you, I love you, I love you!" of a lifetime XuHuan nervous Moncler Chamonix looking at two step outside of the lychee said. "Do you still not understand love! Now you by saying that is only because your male hormones in time! You just want to vent your desire!" To make a sudden nervous litchi fresh fire, side angry side picked up fall on the ground of clothes. "You now just like my body, wait for you to meet another more young than I have more energy body, would you still remember me? I tell you, no!!!!!" Litchi side wear clothes and loud to XuHuan said. XuHuan suddenly from behind embrace is wearing clothes liu li, said: "as long as you don't let me leave you, I lifetime all don't other girls, I only love you, don't let me stand on your side, but give me a distance from the ends of the earth? No matter how you don't I, my heart would remember you, when I grow up I'll marry you!" Hear the XuHuan marry you two words say, litchi suddenly in the arms of XuHuan leng, hand clothes suddenly fell to the ground. "When I grow up, I'll marry you, you must wait for me! I will study hard, I will try to make money, Moncler Everest I'll let you become the world's most happy girl! But, I just want to be you don't leave me!" XuHuan almost cry of the stretching litchi said. From the XuHuan litchi suddenly turned around and put his arms around XuHuan neck, stand on his feet XuHuan lips kiss live. XuHuan don't know what to do, just holding the lychee back let litchi kiss lips. Tears stream down the lychee as XuHuan face rolled on white ceramic floor...... XuHuan and walking side by side in the sunset litchi inclined hang down river, the Moncler Himalaya river overflow the light waves, like great moment of litchi mood, the move is in low light the river flowing quietly, cause litchi infinite sadness. "Don't let this dear!" Litchi straightened sad mood, your right hand to XuHuan said. XuHuan LengZheng in the middle of the bridge, before looking at this recently was his embrace, cry cry of girl's son, now wants and his departure.

# November 8, 2011 12:23 AM

pandora uk said:

You had some nice points here. I done a research on the topic and got most peoples will agree with you

# November 21, 2011 1:22 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)