Re: reduce redundant code
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Tue, 11 Mar 2008 15:29:41 -0500
"MP" <NoSpam@xxxxxxxxxx> wrote in message
news:%23$TdJz6gIHA.4684@xxxxxxxxxxxxxxxxxxxxxxx
have
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:%239iw4B6gIHA.5160@xxxxxxxxxxxxxxxxxxxxxxx
"MP" <NoSpam@xxxxxxxxxx> wrote in message
news:OnSAUgXfIHA.3400@xxxxxxxxxxxxxxxxxxxxxxx
Is there any merit to the following idea?
I find myself repeating lines similar to below in many routines
the idea being I may want to process all objects of just objects who
objectsnipcertain property or whose "container" or "owner" or "child" has certain
property(ies)
thanks for any comments
mark
Your actually chewing on several things at once here.
Get Fowler's book "Refactoring: Improving the Design of Existing Code".
Impossible to give a specific answer as it depends on the over-all
<snipped>of
your design.
Hints: (???? no idea of this is useful or not. <g>)
Whenever you find yourself with a ton of parameters, think object.
If only certain objects of a specific type support something, why not it
let
the object handle it or ignore it?
"Filters" are usually only concerned with bags of stuff. Make it a
propery/method of the Bag.
-ralph
Hi Ralph,
re: your quote
"Filters" are usually only concerned with bags of stuff.
in my case the bag of stuff is the api of the external program my utils
"interact with"
that bag has lots of kinds of objects
the api presents a collection of all the objects in that file from which I
want to select
While I chew on your example, to see if there is anything I can offer that
is simple (and short <g>). Go purchase "Design Patterns Explained: A New
Perspective on Object-Oriented Design" by Shalloway & Trott. No CD so you
can get it cheap.
You will find a path to a solution starting on page 87. You'll still want to
read the first 86. <g>
-ralph
.
- Follow-Ups:
- Re: reduce redundant code
- From: MP
- Re: reduce redundant code
- References:
- reduce redundant code
- From: MP
- Re: reduce redundant code
- From: Ralph
- Re: reduce redundant code
- From: MP
- reduce redundant code
- Prev by Date: Re: Group characters in textbox
- Next by Date: Re: Group characters in textbox
- Previous by thread: Re: reduce redundant code
- Next by thread: Re: reduce redundant code
- Index(es):
Relevant Pages
|
Loading