tag:blogger.com,1999:blog-7507983247248838078.comments2023-05-06T05:05:36.512-07:00Pondering Object Oriented DesignCurtis Cooleyhttp://www.blogger.com/profile/13559671537311158727noreply@blogger.comBlogger48125tag:blogger.com,1999:blog-7507983247248838078.post-79593462414343387222011-02-27T09:41:17.927-08:002011-02-27T09:41:17.927-08:00In fact I often wondered if generics would be an u...In fact I often wondered if generics would be an useful addition for dynamic languages such as PHP. <br />PHP is not based on duck typing only, as it supports Java-like interfaces; but I often write code that would require generics in Java (for things like service or presentation layers) and I simply ignore granular interfaces in this case. <br />For example, I would create a SuperCoolSorter and type hint other classes using SuperCoolSorter, but ignore type safety for checking that a SuperCoolSorter of X objects is not used for sorting Y objects (since its configuration would be different, it may have a collaborator like XOrderStrategy).Giorgiohttps://www.blogger.com/profile/12689416577856305650noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-760239181883807702010-02-25T13:50:57.210-08:002010-02-25T13:50:57.210-08:00I agree! Great advice.
I should really follow it!
...I agree! Great advice.<br />I should really follow it!<br />:)Tinahttps://www.blogger.com/profile/16100890178354183040noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-42140674445958905302010-02-10T08:17:02.448-08:002010-02-10T08:17:02.448-08:00Good advice!Good advice!darosenoreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-42312551856281128762009-10-14T16:47:48.172-07:002009-10-14T16:47:48.172-07:00great post...just in case you haven't seen it ...great post...just in case you haven't seen it yet, there is some fresh insight on the Technical Debt metaphor in Martin Fowler's latest bliki entry: <a href="http://martinfowler.com/bliki/TechnicalDebtQuadrant.html" rel="nofollow">TechnicalDebtQuadrant</a>Philip Schwarzhttps://www.blogger.com/profile/02202819885723986161noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-26535663602043856092009-09-28T07:52:09.653-07:002009-09-28T07:52:09.653-07:00Hi David,
Thanks for stopping by and for your com...Hi David,<br /><br />Thanks for stopping by and for your comment. <br /><br />I agree. You can have great pairing sessions with two keyboards especially if both pairs are already adept at pairing.<br /><br />I think the extra set is a distraction if you are still learning to pair.<br /><br />When I pair at a station with two sets, I set one set aside. I still find it distracting.Curtis Cooleyhttps://www.blogger.com/profile/13559671537311158727noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-75718114832369004442009-09-27T08:01:45.265-07:002009-09-27T08:01:45.265-07:00Amen to that, brother. Where did this idea that pa...Amen to that, brother. Where did this idea that pair programming requires two keyboards come from? Is it just that people have a fundamental unspoken assumption that every programmer has a keyboard, and thus two programmers must have two keyboards? Or was there an early agile project that did it this way, and was copied?<br /><br />There's a photo of the office of the C3 project, where XP was invented, in 'Extreme Programming Explained'. I see one keyboard and one mouse per machine.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-43983932887354339902009-09-25T13:15:18.461-07:002009-09-25T13:15:18.461-07:00Agreed that Pair Progamming != Two Keyboards, but ...Agreed that Pair Progamming != Two Keyboards, but I'd say that Pair Programming != One Keyboard either. <br /><br />As you say, it's about communication.<br /><br />I've personally had great, productive pairing experiences with both one and two keyboards, and with different styles of pairing (driver/navigator, ping pong, etc, etc).David Chelimskyhttps://www.blogger.com/profile/07397532906900221931noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-80261279644627122572009-09-09T10:45:34.807-07:002009-09-09T10:45:34.807-07:00Swing, awt & co. are a really horrible use of ...Swing, awt & co. are a really horrible use of inheritance, up to 6 or 7 levels. This is a good object-oriented design, which opens many wiring possibilities and does not tie classes in a strict hierarchy. Well-written.Giorgiohttps://www.blogger.com/profile/12689416577856305650noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-83237366619311048742009-09-04T19:22:21.057-07:002009-09-04T19:22:21.057-07:00My padawan M$-hater, you are now a jedi.....My padawan M$-hater, you are now a jedi.....Anonymoushttps://www.blogger.com/profile/18244921039774879023noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-20707679717065201522009-08-29T08:13:18.455-07:002009-08-29T08:13:18.455-07:00Hi Karmen,
I'd enjoy pairing with you. I'...Hi Karmen,<br /><br />I'd enjoy pairing with you. I'm planning on actually attending the next meeting. It's this Wed, right?Curtis Cooleyhttps://www.blogger.com/profile/13559671537311158727noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-25609254370005339632009-08-28T23:08:47.806-07:002009-08-28T23:08:47.806-07:00Nice writeup of your experiences. Maybe we could p...Nice writeup of your experiences. Maybe we could pair on it sometime at a ruby user group. :)karmenhttps://www.blogger.com/profile/12398559010608043238noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-28011918361949501532009-08-27T16:54:40.798-07:002009-08-27T16:54:40.798-07:00I thought about branching radtrack, but I'm fo...I thought about branching radtrack, but I'm focusing choreboard on more of a weekly rhythm. I am using radtrack to track my stories for choreboard though :)<br /><br />I like the IBIS format. Especially when I'm arguing with myself.Curtis Cooleyhttps://www.blogger.com/profile/13559671537311158727noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-11481858611052028402009-08-27T16:17:03.452-07:002009-08-27T16:17:03.452-07:00I agree with everything. Another nice post. Here...I agree with everything. Another nice post. Here's a picture that Corey Haines recently put up that says what your post says in 1,000 words: http://picasaweb.google.com/lh/photo/ze0e-jrOCc2zaA1jGzSE9Q?feat=directlinkJohn Goodsenhttps://www.blogger.com/profile/14785659077472008036noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-38232827099716517132009-08-27T16:14:22.848-07:002009-08-27T16:14:22.848-07:00Nice post. Glad to see you use IBIS - I want to ha...Nice post. Glad to see you use IBIS - I want to have support for Ibis discussions in radtrack. Thinking about your rails project - would radtrack work for you instead? If so, maybe you should just hack what you need into a branch from radtrack???? (hint, hint - especially, since I'm using it on 2 real projects right now) :-)John Goodsenhttps://www.blogger.com/profile/14785659077472008036noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-78760114025796261692009-06-10T09:27:52.734-07:002009-06-10T09:27:52.734-07:00Thanks Bob. Good point. I guess I got rolling a li...Thanks Bob. Good point. I guess I got rolling a little too much in the rant.Curtis Cooleyhttps://www.blogger.com/profile/13559671537311158727noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-68899483118775332962009-06-07T12:45:21.419-07:002009-06-07T12:45:21.419-07:00You just bash those lazy people who don't want...You just bash those lazy people who don't want to practice TDD? :)Bob Fosterhttps://www.blogger.com/profile/03976384333510572229noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-88141356140753681322009-03-15T14:56:00.000-07:002009-03-15T14:56:00.000-07:00I definitely see parallels in the real world. I st...I definitely see parallels in the real world. I still recall with utmost clarity my struggle to design before I'd written much code, but I was fortunate to be exposed to good designers while I was learning to construct in Java.<BR/><BR/>I still have my notebook that I drew all that UML in before I even knew what to draw. I like to take it out and flip through it once in a while to remind me of how much I didn't know. Reminds me of how much I still don't know,Curtis Cooleyhttps://www.blogger.com/profile/13559671537311158727noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-45938258534049069192009-03-15T11:57:00.000-07:002009-03-15T11:57:00.000-07:00Okay, that's interesting. To carry the analogy fur...Okay, that's interesting. To carry the analogy further (coming from a family of architects and some-time builders), it's great to be an architect, but the best architects have spent time building. It clearly shows when you have architects who have not built at all and are designing beautiful, but impractical, nearly unbuildable, structures.<BR/><BR/>Does a parallel happen in the software world?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-14130978670268737872009-03-10T13:55:00.000-07:002009-03-10T13:55:00.000-07:00Good post, Curtis. Good rule of thumb for me to r...Good post, Curtis. Good rule of thumb for me to remember!<BR/><BR/>DRAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-12706978644509784672009-03-10T12:55:00.000-07:002009-03-10T12:55:00.000-07:00I really like the technique of returning a zero/em...I really like the technique of returning a zero/empty valued constant. Not only can it simplify the higher-level logic surrounding your data structures as you demonstrate, but it is a good way to slim down the memory use of your objects by coding to the most common use case.<BR/><BR/>For example Sun's LogRecord has fields describing calling class and method, parameters, and the specific level (when the normal use case is "info"). So I would reduce the record to only message, threadId, and millis time. Other fields can be made use of by subclassing.Karl the Paganhttps://www.blogger.com/profile/08670068559230178483noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-44203635308161725762009-01-06T11:30:00.000-08:002009-01-06T11:30:00.000-08:00right after the first code sample you comment that...<I>right after the first code sample you comment that all code should be at the same abstraction level. I think you meant "not.."</I><BR/><BR/>I didn't really explain that part very well. What I meant is the contents of each method should be at the same level of abstraction.<BR/><BR/>I'll try an example:<BR/><BR/>public void parseWebPage(Url url) {<BR/> // these lines are conceptually <BR/> // equally abstract<BR/> String page = getWebPage(url);<BR/> parse(page)<BR/>}<BR/><BR/>private String getWebPage(url) {<BR/> // here you do some more concrete <BR/> // things like open an http connection<BR/>}<BR/><BR/>private void parse(page) {<BR/> // here you do some more concrete things<BR/> // like html parsing and such<BR/>}<BR/><BR/>It's an idea to help with the concept that a method should only do one thing. My method above could have been getAndParseWebPage(Url url) but I felt that since I was passing in a URL the get was implied. Getting the page then parsing the contents are at the same level of abstraction. I use other methods to do the "dirty work" of getting the page from a URL and then actually parsing it. If those methods start to do even more concrete things, those things should be extracted into other methods.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-24914881512502115892009-01-06T10:41:00.000-08:002009-01-06T10:41:00.000-08:00I see a lot of code (like your spike here) that re...I see a lot of code (like your spike here) that really bothers me--and I often see it in production software. <BR/><BR/>I find that if you apply the right refactorings (as you did here) you can end up with Java code as tight as most dynamic (Ruby) code and often more readable; but it takes more thought.<BR/><BR/>I think a generalization might be to say that a good programmer can produce good, dry code in almost any language, and a bad programmer can produce crap in any language--nearly all code falls somewhere in between those two endpoints, but the vast majority seems to be towards the "crap" end.<BR/><BR/>ps. right after the first code sample you comment that all code should be at the same abstraction level. I think you meant "not.."Billhttps://www.blogger.com/profile/13011640626642157799noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-47553961262264779392008-12-12T11:56:00.000-08:002008-12-12T11:56:00.000-08:00Andrew, I understand what you are saying, but I ca...Andrew, I understand what you are saying, but I can't say that I've ever had a case where encapsulating a collection didn't clarify my intent, improve usability and allow some good OO refactors. <BR/><BR/>At first it was just a pattern I noticed, but after seeing how well it worked I started always wrapping them (often along with a few other related variables and code) and it's never failed me.<BR/><BR/>Note, I'm not saying wrap every collection in it's own class--I'm just suggesting that when you find yourself passing a raw collection into a method of another class, think about what your collection really represents, think about anything you need to pass along with that collection, and think about the code that will manipulate it.<BR/><BR/>All those things are probably the core of a nice small class.Billhttps://www.blogger.com/profile/13011640626642157799noreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-70107931721166597972008-12-11T18:08:00.000-08:002008-12-11T18:08:00.000-08:00Is there a non-trivial case you've seen where this...Is there a non-trivial case you've seen where this idea of naked collections as a bad smell fails? <BR/><BR/>IOW, is there a point of going too far in the direction of encapsulating naked collections? <BR/><BR/>Just curious from a newb's perspective...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7507983247248838078.post-39345578181135863282008-12-03T17:03:00.000-08:002008-12-03T17:03:00.000-08:00This note sort of relates to something I've been c...This note sort of relates to something I've been considering lately.<BR/><BR/>There are a handful of features, even in Java, That seem to me--well from a high level conceptual view they are a great idea, but when put into use, the way they tend to be used causes a good deal of bad design.<BR/><BR/>The most obvious: checked exceptions. Does that even need discussion? Same with finalize...<BR/><BR/>Anonymous inner classes: I like them and use them, but I can't tell you how many times I've seen GUI code where 3 AICs are virtually identical except for the value of a single constant. The programmers should have recognized and refactored into a real class if they hadn't been brought up on the "Fact" that you always use AICs to handle events.<BR/><BR/>I worry about this pattern being even more pervasive if (when) they add closures (which can't really be made OO as far as I can tell)<BR/><BR/>Generics--Makes you feel safer passing around collections, however when your collections are encapsulated the benefit of Generics is severely limited.<BR/><BR/>Non-final member variables with access above private. Why? Is this ever really necessary? <BR/><BR/>I think there are one or two more, but they are evading me right now.Billhttps://www.blogger.com/profile/13011640626642157799noreply@blogger.com