I’d suggest changing the validateUrl() method (later renamed validate) to accept the ‘String body’ variable as it’s argument.
This solves the problem of the method being aware of the user interface code (as does the TextSource interface), but it also removes the dependency on the external interface (ala Law of Demeter).
1. I like the idea of passing in the String. It does not resolve the problem of reporting both an error message and success or failure. There are ways around that. E.g., retuning a “result” object that has success/failure and the optional error message. That’s certainly an option. I’ve actually used both options in different systems and I cannot say that one is clearly better than the other. (Returning back a string that is empty for “success” and otherwise an error message is another option. I think that is a bit messy, but it would also certainly work.)
2. Law of Demeter violation. Passing in an interface is not a violation of the Law of Demeter. Sending message to that interface is also not a violation. There is a violation if I send message to the String I get back from the interface.
Violation of the Law of Demeter is a problem because it introduces structural coupling. Sometimes violating the law is a better option that the potential interface bloat that can be associated with not violating. Typically, for long chains, removing part of the violation is the best option. This example is not that situation, however.
In this case, the violation doesn’t seem too bad since the dependency is on a string. The risk of that needing to change is small, so the potential down side is small.
Technically for the UrlValidator there is no violation since it gets a string and the passes it to another object. It does not send a message, so no violation. I cannot get away with that in the other two validators, however.
So then the question is this: Is the violation of the Law of Demeter (sending message to the string) plus the introduction of an interface better or worse than returning a composite object (or a string which must be interpreted – let’s rule this option out – in real systems we typically return all errors not just one, so the string itself becomes a composite string – /ugly/).
I’m not sure there’s enough context to decide. We either introduce an interface or a concrete class (the return object). So no win there. There is the creation of an instance of a return object versus no object creation (plus in the pass in the interface option). Again, I’m not convinced that there’s enough to make a decision.
I think I still prefer the interface over passing in the string when considering that there are 2 return values (success/failure and error message). But, it certainly doesn’t rule out your suggestion. It’s just my preference
Yes, of course. However, such tools are only one piece of an overall checking (to use Michael Bolton’s term) strategy.
The refactoring introduces a separation of concerns that should have been there in the first place. This allows for focused verification of functionality without having to resort to a “gui driver.”
The refactoring introduces a separation of concerns that should have been there in the first place. This allows for focused verification of functionality without having to resort to a “gui driver.”
I agree, this should only be one tool in a multi-valent set of strategic checking. I agree, in this instance, that passing in the string is a little dangerous when you have multiple return values.
cheap vps
11 months later:
So then the question is this: Is the violation of the Law of Demeter (sending message to the string) plus the introduction of an interface better or worse than returning a composite object (or a string which must be interpreted – let’s rule this option out – in real systems we typically return all errors not just one, so the string itself becomes a composite string – /ugly/).
I’m not sure there’s enough context to decide. We either introduce an interface or a concrete class (the return object). So no win there. There is the creation of an instance of a return object versus no object creation (plus in the pass in the interface option). Again, I’m not convinced that there’s enough to make a decision.
I think I still prefer the interface over passing in the string when considering that there are 2 return values (success/failure and error message). But, it certainly doesn’t rule out your suggestion. It’s just my preferencecheap VPS
Listings
12 months later:
The re factoring introduces a separation of concerns that should have been there in the first place.Thanks for sharing.. very useful for me i will bookmark this for my future needed. thanks for a great source.
Listings
your initial website design may need to be frames based because you don’t have time to build an Ajax framework.
http://www.whiteiphone4transformer.com
about 1 year later:
The white iphone 4 hardware design hasn’t changed from the one we already knew about. It uses the same materials as the prototype: Black glass and stainless steel rim.
I am just new to your blog and just spent about 1 hour and 30 minutes lurking and reading. I think I will frequent your blog from now on after going through some of your posts. I will definitely learn a lot from them.
Men at some point understands that they will be the master-gardener involving the heart, your representative involving the lifestyle. Men whom dares for you to squander an hour of your energy haven’t found out the significance involving lifestyle. Most lifestyle is surely an research. Greater findings anyone create better. The many art work involving existing is based on a fine interacting involving enabling get along with holding on. Just about any idiot could deal with an emergency – it can be day by day existing that will has on anyone out and about. Feel that lifestyle may be valued at existing plus your notion might help develop simple fact.
One thing I can tell you for sure after checking your code sample here: you are a better programmer than I am. I have trouble understanding some sequences. That tells a lot, doesn’t it?
Women’s high heels of four- to six-inches are very hot for all occasions and with all levels of dress, from casual to professional.The Softspots sandals also offer heels of varying sizes to suit different tastes and needs.The use of soft genuine leather adds to both the comfort and stylistic elements of these women’s dress sandals.While some women are drawn to comfortable flats, others are sporting extreme high heels that measure up to 8-inches high.High heel shoes are better for those brides whose grooms are much taller than them, it’s a good to wear heel shoes so bride can match their height.Below is a look at the women’s trending shoe styles that are hot and selling fast this year in stores and through online shopping.The wide width dress sandals from Softspots are extremely popular because of the high level of comfort they offer while retaining the style element.
abercrombie and fitch
about 1 year later:
If Abercrombie & Fitch is really concerned that the Situation and company have appeared on air in its garments, it doesn’t appear that angry.Bienvenue pour parcourir Abercrombie France site en ligne, vente en ligne New Style Belstaff en France, vous pouvez acheter la qualite superieure et escompte.Teen apparel retailer Abercrombie & Fitch Co. is offering to pay Michael “The Situation” Sorrentino not to wear its merchandise.Abercrombie Paris est le vêtement de la marque originale et riche d’une histoire enracinee dans le grand air et de la cote Est Ivy League.
fort jefferson Thanks for sharing this information. I really like your way of expressing the opinions and sharing the information. It is good to move as chance bring new things in life, paves the way for advancement,
Thank you for taking the time to publish this information very useful!I’m still waiting for some interesting thoughts from your side in your next post thanks These articles written too great,they rich contents ma le scarpe non ti donano. meglio dei sandali con stringe più sottili e caviglia libera Perfect! and data accurately.they are help to me.I expect to see your new share.
online pokies
over 2 years later:
One thing I can tell you for sure after checking your code sample here: you are a better programmer than I am. I have trouble understanding some sequences. That tells a lot, doesn’t it?
online pokies
<a href="http://www.cheapsuprasuk.com/supra-high-tops-supra-skytop-shoes-c-4_13.html">Supra Muska Skytop</a>
over 2 years later:
Its perhaps a secure choice to express that a good deal of most people, when installing packages, overlook a particular exceptionally essential point. They overlook that they will need to look at the owners manual. Failure to master the connected substance is often the downfall of each and every application application during the marketplace. Nowhere is this truer than with Shoes robot software application. Various men and women set up their obtained software application and proper away start playing straight to the Shoes marketplace. This might be a horrible prepare and only one absolute to lead to anybody to shed cash. Hence when Supra shoes started out delivering its mini-course, it was a blessing in disguise.
The professional design make you foot more comfortable. Even more tantalizing,this pattern make your legs look as long as you can,it will make you looked more attractive.Moveover,it has reasonable price.If you are a popular woman,do not miss it.
Technical details of Christian Louboutin Velours Scrunch Suede Boots Coffee:
Color: Coffee
Material: Suede
4(100mm) heel
Signature red sole x
Fashion, delicate, luxurious Christian louboutins shoes on sale, one of its series is Christian Louboutin Tall Boots, is urbanism collocation. This Christian louboutins shoes design makes people new and refreshing. Red soles shoes is personality, your charm will be wonderful performance.
En mer personlig ljus, men ocks? cool. ralph Lauren detta m?rke ?r verkligen ?lskling de europeiska konsumenterna. Speciellt m?nnen ut av det mer polo Ralph Lauren sweater En herre. N?r ?r det mer viktigt s? att kvaliteten ?r mycket bra, ?r stilen mycket nytt, aldrig inaktuell.
discount Ralph Lauren polo
Señor blog impresionante. Sus artículos son increíbles. Pase por mi blog en el corto plazo si desea alguna información fresca sobre las camisas en ejecución.
It is really a good example that most of the programmer should think about this. If we want to do much better for the code. I should understand it. right? You are very good at this and show us good coding idea.
I’d suggest changing the validateUrl() method (later renamed validate) to accept the ‘String body’ variable as it’s argument.
This solves the problem of the method being aware of the user interface code (as does the TextSource interface), but it also removes the dependency on the external interface (ala Law of Demeter).
Mark,
1. I like the idea of passing in the String. It does not resolve the problem of reporting both an error message and success or failure. There are ways around that. E.g., retuning a “result” object that has success/failure and the optional error message. That’s certainly an option. I’ve actually used both options in different systems and I cannot say that one is clearly better than the other. (Returning back a string that is empty for “success” and otherwise an error message is another option. I think that is a bit messy, but it would also certainly work.)
2. Law of Demeter violation. Passing in an interface is not a violation of the Law of Demeter. Sending message to that interface is also not a violation. There is a violation if I send message to the String I get back from the interface.
Violation of the Law of Demeter is a problem because it introduces structural coupling. Sometimes violating the law is a better option that the potential interface bloat that can be associated with not violating. Typically, for long chains, removing part of the violation is the best option. This example is not that situation, however.
In this case, the violation doesn’t seem too bad since the dependency is on a string. The risk of that needing to change is small, so the potential down side is small.
Technically for the UrlValidator there is no violation since it gets a string and the passes it to another object. It does not send a message, so no violation. I cannot get away with that in the other two validators, however.
So then the question is this: Is the violation of the Law of Demeter (sending message to the string) plus the introduction of an interface better or worse than returning a composite object (or a string which must be interpreted – let’s rule this option out – in real systems we typically return all errors not just one, so the string itself becomes a composite string – /ugly/).
I’m not sure there’s enough context to decide. We either introduce an interface or a concrete class (the return object). So no win there. There is the creation of an instance of a return object versus no object creation (plus in the pass in the interface option). Again, I’m not convinced that there’s enough to make a decision.
I think I still prefer the interface over passing in the string when considering that there are 2 return values (success/failure and error message). But, it certainly doesn’t rule out your suggestion. It’s just my preference
Have you considered using a GUI testing framework such as http://code.google.com/p/windowlicker/
isaiah,
Yes, of course. However, such tools are only one piece of an overall checking (to use Michael Bolton’s term) strategy.
The refactoring introduces a separation of concerns that should have been there in the first place. This allows for focused verification of functionality without having to resort to a “gui driver.”
Good post….thanks for sharing.. very useful for me i will bookmark this for my future needed. thanks for a great source.
The refactoring introduces a separation of concerns that should have been there in the first place. This allows for focused verification of functionality without having to resort to a “gui driver.”
chang it
I agree, this should only be one tool in a multi-valent set of strategic checking. I agree, in this instance, that passing in the string is a little dangerous when you have multiple return values.
So then the question is this: Is the violation of the Law of Demeter (sending message to the string) plus the introduction of an interface better or worse than returning a composite object (or a string which must be interpreted – let’s rule this option out – in real systems we typically return all errors not just one, so the string itself becomes a composite string – /ugly/).
I’m not sure there’s enough context to decide. We either introduce an interface or a concrete class (the return object). So no win there. There is the creation of an instance of a return object versus no object creation (plus in the pass in the interface option). Again, I’m not convinced that there’s enough to make a decision.
I think I still prefer the interface over passing in the string when considering that there are 2 return values (success/failure and error message). But, it certainly doesn’t rule out your suggestion. It’s just my preferencecheap VPS
The re factoring introduces a separation of concerns that should have been there in the first place.Thanks for sharing.. very useful for me i will bookmark this for my future needed. thanks for a great source. Listings
Nice post, Thanks.
your initial website design may need to be frames based because you don’t have time to build an Ajax framework.
The white iphone 4 hardware design hasn’t changed from the one we already knew about. It uses the same materials as the prototype: Black glass and stainless steel rim.
Web master & all thanks for kind information.. I am going to bookmark this page. keep it up.
i found that it is very impressive & nice post you r such a good writer any how thank you for sharing with us
thanks for your useful posting and sharing with us
Great blog post, I have been waiting for that
Great blog post, I have been waiting for that
nice information
internette görüntülü olarak okey oyunu oyna, gerçek kisilerle tanis, turnuva heyecanini yasa.
I am just new to your blog and just spent about 1 hour and 30 minutes lurking and reading. I think I will frequent your blog from now on after going through some of your posts. I will definitely learn a lot from them.
You brought some nice points there. i did a search and found that mostly people gave u compliments.
Men at some point understands that they will be the master-gardener involving the heart, your representative involving the lifestyle. Men whom dares for you to squander an hour of your energy haven’t found out the significance involving lifestyle. Most lifestyle is surely an research. Greater findings anyone create better. The many art work involving existing is based on a fine interacting involving enabling get along with holding on. Just about any idiot could deal with an emergency – it can be day by day existing that will has on anyone out and about. Feel that lifestyle may be valued at existing plus your notion might help develop simple fact.
One thing I can tell you for sure after checking your code sample here: you are a better programmer than I am. I have trouble understanding some sequences. That tells a lot, doesn’t it?
I love to read this type of stuff. Good and attractive information I take from it..Thank you for posting such a nice article
. Good and attractive information I take from it..Thank you for posting such a nice articlecheap beats by dre beats by dre store
Women’s high heels of four- to six-inches are very hot for all occasions and with all levels of dress, from casual to professional.The Softspots sandals also offer heels of varying sizes to suit different tastes and needs.The use of soft genuine leather adds to both the comfort and stylistic elements of these women’s dress sandals.While some women are drawn to comfortable flats, others are sporting extreme high heels that measure up to 8-inches high.High heel shoes are better for those brides whose grooms are much taller than them, it’s a good to wear heel shoes so bride can match their height.Below is a look at the women’s trending shoe styles that are hot and selling fast this year in stores and through online shopping.The wide width dress sandals from Softspots are extremely popular because of the high level of comfort they offer while retaining the style element.
If Abercrombie & Fitch is really concerned that the Situation and company have appeared on air in its garments, it doesn’t appear that angry.Bienvenue pour parcourir Abercrombie France site en ligne, vente en ligne New Style Belstaff en France, vous pouvez acheter la qualite superieure et escompte.Teen apparel retailer Abercrombie & Fitch Co. is offering to pay Michael “The Situation” Sorrentino not to wear its merchandise.Abercrombie Paris est le vêtement de la marque originale et riche d’une histoire enracinee dans le grand air et de la cote Est Ivy League.
This looks absolutely perfect. All these tinny details are made with lot of background knowledge. I like it
the 2011 moncler for the winter is beautiful.
fort jefferson Thanks for sharing this information. I really like your way of expressing the opinions and sharing the information. It is good to move as chance bring new things in life, paves the way for advancement,
Thank you for taking the time to publish this information very useful!I’m still waiting for some interesting thoughts from your side in your next post thanks These articles written too great,they rich contents ma le scarpe non ti donano. meglio dei sandali con stringe più sottili e caviglia libera Perfect! and data accurately.they are help to me.I expect to see your new share.
One thing I can tell you for sure after checking your code sample here: you are a better programmer than I am. I have trouble understanding some sequences. That tells a lot, doesn’t it? online pokies
Its perhaps a secure choice to express that a good deal of most people, when installing packages, overlook a particular exceptionally essential point. They overlook that they will need to look at the owners manual. Failure to master the connected substance is often the downfall of each and every application application during the marketplace. Nowhere is this truer than with Shoes robot software application. Various men and women set up their obtained software application and proper away start playing straight to the Shoes marketplace. This might be a horrible prepare and only one absolute to lead to anybody to shed cash. Hence when Supra shoes started out delivering its mini-course, it was a blessing in disguise.
It really a good article.replica Oakley Enduring Pace Sunglassescheap oakley five squared sunglassesoakley five squared sunglasses wholesalereplica oakley five squared sunglassescheap Oakley Fives SunglassesOakley Fives Sunglasses wholesalereplica Oakley Fives Sunglassesoakley flak jacket sunglasses wholesaleReplica Oakley Juliet SunglassesReplica Oakley Fuel Cell SunglassesReplica Oakley Half Jacket SunglassesReplica Oakley Holbrook SunglassesFake Oakley Radar sunglassesFake Oakley Oil Rig sunglassesFake Oakley Polarized sunglassesFake Oakley Antix sunglassesOakley Enduring Pace SunglassesOakley Zero SunglassesOakley Active SunglassesOakley Juliet Sunglasses
I like the style of this article, is very good.oakley mens flak jacket sunglassesoakley half jacket sunglassesdiscount oakley half jacket sunglassesoakley half jacket sunglasses saleoakley mens half jacket sunglassesoakley jawbone sunglassesdiscount oakley jawbone sunglassesoakley jawbone sunglasses saleoakley mens jawbone sunglassesoakley m frame sunglassesdiscount oakley m frame sunglassesoakley m frame sunglasses saleoakley mens m frame sunglasses
I like it. come on oakley mens antix sunglassesoakley batwolf sunglassesdiscount oakley batwolf sunglassesoakley batwolf sunglasses saleoakley mens batwolf sunglassesoakley dispatch sunglassesdiscount oakley dispatch sunglassesoakley dispatch sunglasses saleoakley mens dispatch sunglassesoakley fives squared sunglassesdiscount oakley fives squared sunglassesoakley fives squared sunglasses saleoakley mens fives squared sunglasses
I love this article, it’s very well.Fake Oakley Batwolf SunglassesFake Oakley BottlecapFake Oakley CrosshairFake Oakley Flak Jacket
It’s wonderful, thank you. Oakley Antix SunglassesOakley Batwolf SunglassesOakley Dispatch SunglassesOakley Fives Squared SunglassesFake Oakley Half X sunglassesFake Oakley Hijinx sunglassesFake Oakley M Frame sunglassesFake Oakley Minute sunglassesReplica Oakley Minute SunglassesReplica Oakley Monster Dog SunglassesReplica Oakley Pit Boss SunglassesReplica Oakley Restless SunglassesReplica Oakley Half WireReplica Oakley Half XReplica Oakley Hijinxoakley m frame sunglasses wholesalereplica oakley m frame sunglassescheap oakley minute sunglassesoakley minute sunglasses wholesalereplica oakley minute sunglassescheap oakley monster dog sunglassesoakley monster dog sunglasses wholesale
That was a great piece of information
The professional design make you foot more comfortable. Even more tantalizing,this pattern make your legs look as long as you can,it will make you looked more attractive.Moveover,it has reasonable price.If you are a popular woman,do not miss it.
Technical details of Christian Louboutin Velours Scrunch Suede Boots Coffee:
Fashion, delicate, luxurious Christian louboutins shoes on sale, one of its series is Christian Louboutin Tall Boots, is urbanism collocation. This Christian louboutins shoes design makes people new and refreshing. Red soles shoes is personality, your charm will be wonderful performance.
That was a great piece of information
http://www.spyderjackets-outlet.net
http://www.arcteryxjackets-sale.com
En mer personlig ljus, men ocks? cool. ralph Lauren detta m?rke ?r verkligen ?lskling de europeiska konsumenterna. Speciellt m?nnen ut av det mer polo Ralph Lauren sweater En herre. N?r ?r det mer viktigt s? att kvaliteten ?r mycket bra, ?r stilen mycket nytt, aldrig inaktuell. discount Ralph Lauren polo
Señor blog impresionante. Sus artículos son increíbles. Pase por mi blog en el corto plazo si desea alguna información fresca sobre las camisas en ejecución.
It is really a good example that most of the programmer should think about this. If we want to do much better for the code. I should understand it. right? You are very good at this and show us good coding idea.