tag:blogger.com,1999:blog-15045980.post276719960416223477..comments2024-03-18T02:13:03.999-07:00Comments on Google Testing Blog: Breaking the Law of Demeter is Like Looking for a Needle in the HaystackMarkohttp://www.blogger.com/profile/16755629501705100354noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-15045980.post-74800234599315102952016-12-27T03:26:41.629-08:002016-12-27T03:26:41.629-08:00what if my class needs too many configs - do I nee...what if my class needs too many configs - do I need to send each as separate constructor argument or should I wrap the configs in a wrapper and send that in constructor. <br />Basically my class is dbutil class which needs jdbc url,user,password and table names. Now one method of dbutil fetches data from table1 and another from table2. Jdbc url,user,password,table1,table2 are read from configuration file at startup of application along with various other configs. What should I pass to dbutil constructor- a wrapper containing url,user,password,table1,table2 and store that in intance variable or just jdbc url,user,apssword in constructor and table name should be passed only when calling function of dbutil.shushanthttps://www.blogger.com/profile/12326732930761219654noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-45219685741711456072008-07-28T12:32:00.000-07:002008-07-28T12:32:00.000-07:00Nice post, but you should be more careful about yo...Nice post, but you should be more careful about your use of "false negative". In testing, a "false negative" occurs when something was broken, yet the tests all passed. You're referring to a "false positive", in which the tests fail even though nothing is wrong.Neil Curzonhttps://www.blogger.com/profile/02488611308773565031noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-50392625288067176872008-07-23T08:55:00.000-07:002008-07-23T08:55:00.000-07:00Why not just push the dev team for a better design...Why not just push the dev team for a better design?! :)Kristian J.https://www.blogger.com/profile/11311199951104096766noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-85935217047891273102008-07-23T07:13:00.000-07:002008-07-23T07:13:00.000-07:00Is the android team reading this ?Is the android team reading this ?KetanPadegaonkarhttps://www.blogger.com/profile/00708547712729097047noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-22464576086549155872008-07-23T06:50:00.000-07:002008-07-23T06:50:00.000-07:00FYI The needle referred to in the common phrase is...FYI The needle referred to in the common phrase is not a sewing needle, it is a haystack needle, used for pinning the haystack together.<BR/><BR/>:)Matthttps://www.blogger.com/profile/01863908675256558774noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-7974572256172485472008-07-23T06:23:00.001-07:002008-07-23T06:23:00.001-07:00@apexrally Yes, it does, although they wouldn't pa...@apexrally Yes, it does, although they wouldn't particularly help in this problemMichael Mrozekhttps://www.blogger.com/profile/08593850922533973503noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-45646617280116428612008-07-23T06:23:00.000-07:002008-07-23T06:23:00.000-07:00I hope the android team reads this post.I hope the android team reads this post.Robert "kebernet" Cooperhttps://www.blogger.com/profile/03336622901079453553noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-32136632726717095982008-07-23T05:39:00.000-07:002008-07-23T05:39:00.000-07:00@stephanYes! Properly using a dependency injection...@stephan<BR/><BR/>Yes! Properly using a dependency injection container is a marvelous fix to this problem. We had a similar situation in a fairly large codebase, and we slowly fixed this problem over a few months time, eventually removing almost all dependencies on Context. We used Spring, but whatever. The thing to remember is NOT to shove Context into the DI container. Just put the dependencies. We would focus on one Context "getter" at a time and slowly remove all the usages of it, eventually eliminating the getter itself. <BR/><BR/>I highly recommend doing this! Test are so much easier.Hamlet D'Arcyhttps://www.blogger.com/profile/04008870357169725586noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-78402019267409530742008-07-23T04:42:00.000-07:002008-07-23T04:42:00.000-07:00Does Java have the concept of Generics like C#? I...Does Java have the concept of Generics like C#? I think a bigger question to consider is "Why is software engineering such an immature engineering discipline?"Kristian J.https://www.blogger.com/profile/11311199951104096766noreply@blogger.comtag:blogger.com,1999:blog-15045980.post-37654673844274344342008-07-23T01:29:00.000-07:002008-07-23T01:29:00.000-07:00I was thinking about using Google Guice Providers ...I was thinking about using Google Guice Providers to solve the Problem.<BR/><BR/>Something like:<BR/><BR/><BR/>@Provider<BR/>EngineProvider(Context context) { ...}<BR/>public Engine get() { return context.getEngine(); }<BR/><BR/><BR/>Then you can have a Context and only inject Engine into the Mechanic class. The adaption is handled by Guice.<BR/><BR/>Peace<BR/>-stephanStephan.Schmidthttps://www.blogger.com/profile/03845125686370893937noreply@blogger.com