I would try to extract all those things that are 100% the same, generalize the code, then make a higher level abstract object that the others extend from.  I have tried this technique before when I run into the problems you are describing and it has worked out in the past.
<br><br><div><span class="gmail_quote">On 11/28/05, <b class="gmail_sendername">Scott Phillips</b> &lt;<a href="mailto:scott.phillips@drake.edu">scott.phillips@drake.edu</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Here's the problem I've been having with my OO approach. If someone has any<br>words of wisdom here, that'd be great.<br><br>Every time I need to work with&nbsp;&nbsp;a new &quot;thing&quot; (object) I find myself<br>creating a new class that is almost identical to all the others I've
<br>written. In fact, when pressed for time, I've been known to save a copy of<br>an existing class, do a find/replace on a number of terms, and then make<br>whatever changes are necessary. So I've got a dozen or more 200-300 line
<br>classes that are 80% identical (and that's with stuff like db connectivity<br>abstracted out). They all seem to do the same things... get some data,<br>manipulate it, store it, retrieve it. Yeah, I know that this should raise
<br>some big red flags in terms of my approach but I keep doing it anyway.<br><br><br><br><br>At 04:49 PM 11/25/2005 -0600, you wrote:<br>&gt;I agree.&nbsp;&nbsp;There's not a whole lot of difference so far, but I think that's<br>&gt;because I haven't learned enough to do much else with classes than put a
<br>&gt;bunch of functions inside them.&nbsp;&nbsp;I really haven't begun to scratch the<br>&gt;surface yet.&nbsp;&nbsp;I'm inheriting my data connections from a class file, which<br>&gt;seems like an easier to do it.&nbsp;&nbsp;I'm not sure I couldn't have done the same
<br>&gt;thing with a bunch of functions in an included file.&nbsp;&nbsp;I guess the main<br>&gt;benefit I'm seeing is that I'm putting a lot more code into functions and<br>&gt;putting them in a separate file.&nbsp;&nbsp;I'm not sure it's OOP that is making me do
<br>&gt;that, but I wasn't doing it before and I'm really starting to see the<br>&gt;benefit because it makes things a lot easier to figure out when I come back<br>&gt;and look at the code several months later.&nbsp;&nbsp;I'm giving OOP the credit for
<br>&gt;that, although I may be off base.<br>&gt;<br>&gt;Carl<br>&gt;<br>&gt;-----Original Message-----<br>&gt;From: <a href="mailto:ciapug-bounces@cialug.org">ciapug-bounces@cialug.org</a> [mailto:<a href="mailto:ciapug-bounces@cialug.org">
ciapug-bounces@cialug.org</a>] On Behalf<br>&gt;Of Dave J. Hala Jr.<br>&gt;Sent: Friday, November 25, 2005 11:10 AM<br>&gt;To: <a href="mailto:carl-olsen@mchsi.com">carl-olsen@mchsi.com</a>; PHP List<br>&gt;Subject: RE: [ciapug] Web Professionalism
<br>&gt;<br>&gt;I have all kinds of inc files with string formating libraries, database<br>&gt;connectivity, listboxes and all that stuff... I have tons of code that I<br>&gt;reuse, that code&nbsp;&nbsp;is kept in include files.&nbsp;&nbsp;I have my html include,
<br>&gt;database connectivity include, formatting include, etc.<br>&gt;<br>&gt;They are just not called &quot;objects&quot; and &quot;classes&quot;, they are collections<br>&gt;of functions and procedures.<br>&gt;<br>&gt;I have almost no php code in any of my .html files, in fact I keep all
<br>&gt;my html and php code seperate.<br>&gt;<br>&gt;<br>&gt;On Fri, 2005-11-25 at 09:45, Carl Olsen wrote:<br>&gt; &gt; I appreciate it.&nbsp;&nbsp;I think you verbalized it well.&nbsp;&nbsp;You are still learning<br>&gt; &gt; and your code just reflects the level you are at.&nbsp;&nbsp;That's exactly what I'm
<br>&gt; &gt; doing.&nbsp;&nbsp;The difference I see is that I frequently do the same things over<br>&gt; &gt; and over again.&nbsp;&nbsp;I'm frequently writing code to maintain some kind of<br>&gt; &gt; inventory table in a database.&nbsp;&nbsp;I've written class files that contain all
<br>&gt; &gt; the code I need for display a drop down list (you feed it the name you<br>&gt;want<br>&gt; &gt; the input control to have, the value if it has a value, and all the html<br>&gt; &gt; necessary to rending the control.&nbsp;&nbsp;I've written class files with nothing
<br>&gt;but<br>&gt; &gt; string formatting functions.&nbsp;&nbsp;I usually write a class that opens and<br>&gt;closes<br>&gt; &gt; my connection to the database and then my other classes that maintain the<br>&gt; &gt; tables inherit from that database class.&nbsp;&nbsp;The more I do it, the more I
<br>&gt;like<br>&gt; &gt; it.&nbsp;&nbsp;It makes the code modular and reusable.&nbsp;&nbsp;I'm finding it easier to go<br>&gt; &gt; back and maintain it later.&nbsp;&nbsp;I'm moving from a procedural model to an<br>&gt;object<br>&gt; &gt; oriented model, because I've been doing the procedural model for so long
<br>&gt; &gt; it's no longer difficult.&nbsp;&nbsp;When I first started learning PHP, it was<br>&gt;easier<br>&gt; &gt; to drop all the code directly into the HTML page in the exact spot where<br>&gt;it<br>&gt; &gt; was going to perform some function.&nbsp;&nbsp;Now that I feel comfortable with
<br>&gt;that,<br>&gt; &gt; I'm looking for ways to make the code more modular, and OOP is it.<br>&gt; &gt;<br>&gt; &gt; Thank you very much!<br>&gt; &gt;<br>&gt; &gt; Carl<br>&gt; &gt; <a href="http://www.carl-olsen.com/">
http://www.carl-olsen.com/</a><br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; -----Original Message-----<br>&gt; &gt; From: <a href="mailto:ciapug-bounces@cialug.org">ciapug-bounces@cialug.org</a> [mailto:<a href="mailto:ciapug-bounces@cialug.org">
ciapug-bounces@cialug.org</a>] On<br>&gt;Behalf<br>&gt; &gt; Of Dave J. Hala Jr.<br>&gt; &gt; Sent: Friday, November 25, 2005 7:58 AM<br>&gt; &gt; To: <a href="mailto:carl-olsen@mchsi.com">carl-olsen@mchsi.com</a>; PHP List
<br>&gt; &gt; Subject: RE: [ciapug] Web Professionalism<br>&gt; &gt;<br>&gt; &gt; It's difficult to verbalize. Let me try... I think that procedural<br>&gt; &gt; programming is more like the thought process I use.&nbsp;&nbsp; Not that I don't
<br>&gt; &gt; sometimes think in &quot;object mode&quot;, because I usually do at the beginning<br>&gt; &gt; of the process. (that's the curse of us south paws...)<br>&gt; &gt;<br>&gt; &gt; Usually, I'll conceptualize the problem, then break it into components
<br>&gt; &gt; (objects)&nbsp;&nbsp;Typically, I'll start in the middle of the problem and work<br>&gt; &gt; my way out. Once I have compartmentalized all my components, (objects)<br>&gt; &gt; I'll define each one using psuedo code. Then I'll convert that to code.
<br>&gt; &gt;<br>&gt; &gt; The pseudo code tends to be really linear and that seems to favor<br>&gt; &gt; procedural methods. If I had &quot;pre-made&quot; objects, I could probably skip<br>&gt; &gt; the definition stage. Then I would be doing OOP. However, most of my
<br>&gt; &gt; stuff is very, very specific and won't fit well into a generic object<br>&gt; &gt; container. ( did I say that?!!)<br>&gt; &gt;<br>&gt; &gt; Not to be off subject, but I think the key component of the &quot;web
<br>&gt; &gt; proffesional&quot; topic isn't really about how everyone else is doing it, or<br>&gt; &gt; what the current trends are, but its more about continually learning and<br>&gt; &gt; applying new techniques as they are appropriate in your envirnoment. In
<br>&gt; &gt; other words, developers need to continually grow and evolve, as do the<br>&gt; &gt; systems they maintain.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; On Thu, 2005-11-24 at 19:45, Carl Olsen wrote:<br>&gt; &gt; &gt; What do you like better about procedural?
<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; -----Original Message-----<br>&gt; &gt; &gt; From: <a href="mailto:ciapug-bounces@cialug.org">ciapug-bounces@cialug.org</a> [mailto:<a href="mailto:ciapug-bounces@cialug.org">ciapug-bounces@cialug.org
</a>] On<br>&gt; &gt; Behalf<br>&gt; &gt; &gt; Of Dave J. Hala Jr.<br>&gt; &gt; &gt; Sent: Thursday, November 24, 2005 6:04 PM<br>&gt; &gt; &gt; To: <a href="mailto:carl-olsen@mchsi.com">carl-olsen@mchsi.com</a>; PHP List
<br>&gt; &gt; &gt; Subject: RE: [ciapug] Web Professionalism<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; I'm not against OOP PHP code, I do a little of it but I still prefer to<br>&gt; &gt; &gt; do procedural.<br>&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Thu, 2005-11-24 at 16:27, Carl Olsen wrote:<br>&gt; &gt; &gt; &gt; I have a question for everyone.&nbsp;&nbsp;How many people prefer to write<br>&gt; &gt; &gt; procedural<br>&gt; &gt; &gt; &gt; PHP code as opposed to object oriented (OOP) PHP code?
<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Carl<br>&gt; &gt; &gt; &gt; <a href="http://www.carl-olsen.com/">http://www.carl-olsen.com/</a><br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; -----Original Message-----<br>&gt; &gt; &gt; &gt; From: 
<a href="mailto:ciapug-bounces@cialug.org">ciapug-bounces@cialug.org</a> [mailto:<a href="mailto:ciapug-bounces@cialug.org">ciapug-bounces@cialug.org</a>] On<br>&gt; &gt; &gt; Behalf<br>&gt; &gt; &gt; &gt; Of laith<br>&gt; &gt; &gt; &gt; Sent: Thursday, November 17, 2005 6:43 AM
<br>&gt; &gt; &gt; &gt; To: <a href="mailto:ciapug@cialug.org">ciapug@cialug.org</a><br>&gt; &gt; &gt; &gt; Subject: Re: [ciapug] Web Professionalism<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Keeping up is always good.
<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Unfortunately not everyone thinks this way so many good things you<br>&gt;might<br>&gt; &gt;<br>&gt; &gt; &gt; &gt; learn will not be useful for longer than it should take.<br>
&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Laith<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Chris Van Cleve wrote:<br>&gt; &gt; &gt; &gt; &gt; There has been a flurry of articles this week about New Web<br>&gt; &gt; &gt; &gt; &gt; professionalism.
<br>&gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; See: <a href="http://webstandards.org/buzz/archive/2005_11.html#a000590">http://webstandards.org/buzz/archive/2005_11.html#a000590</a><br>&gt; &gt; &gt; &gt; &gt; <a href="http://webstandards.org/">
http://webstandards.org/</a><br>&gt; &gt; &gt; &gt; &gt; <a href="http://www.456bereastreet.com/archive/200511/">http://www.456bereastreet.com/archive/200511/</a><br>&gt; &gt; &gt; &gt; &gt; a_web_professional_can_never_stop_learning/
<br>&gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; I believe in this whole-heartedly. Keeping up with standards,<br>&gt; &gt; &gt; &gt; &gt; methodologies, trends, etc. is important as a true professional. I<br>&gt;am
<br>&gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; curious what everyone else's take on this is.<br>&gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; Chris VC<br>&gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; _______________________________________________
<br>&gt; &gt; &gt; &gt; &gt; ciapug mailing list<br>&gt; &gt; &gt; &gt; &gt; <a href="mailto:ciapug@cialug.org">ciapug@cialug.org</a><br>&gt; &gt; &gt; &gt; &gt; <a href="http://cialug.org/mailman/listinfo/ciapug">http://cialug.org/mailman/listinfo/ciapug
</a><br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; _______________________________________________<br>&gt; &gt; &gt; &gt; ciapug mailing list<br>&gt; &gt; &gt; &gt; <a href="mailto:ciapug@cialug.org">ciapug@cialug.org</a>
<br>&gt; &gt; &gt; &gt; <a href="http://cialug.org/mailman/listinfo/ciapug">http://cialug.org/mailman/listinfo/ciapug</a><br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; _______________________________________________<br>&gt; &gt; &gt; &gt; ciapug mailing list
<br>&gt; &gt; &gt; &gt; <a href="mailto:ciapug@cialug.org">ciapug@cialug.org</a><br>&gt; &gt; &gt; &gt; <a href="http://cialug.org/mailman/listinfo/ciapug">http://cialug.org/mailman/listinfo/ciapug</a><br>&gt;--<br>&gt;<br>
&gt;Open Source Information Systems, Inc. (OSIS)<br>&gt;Dave J. Hala Jr., President &lt;<a href="mailto:dave@osis.us">dave@osis.us</a>&gt;<br>&gt;641.485.1606<br>&gt;<br>&gt;_______________________________________________
<br>&gt;ciapug mailing list<br>&gt;<a href="mailto:ciapug@cialug.org">ciapug@cialug.org</a><br>&gt;<a href="http://cialug.org/mailman/listinfo/ciapug">http://cialug.org/mailman/listinfo/ciapug</a><br>&gt;<br>&gt;_______________________________________________
<br>&gt;ciapug mailing list<br>&gt;<a href="mailto:ciapug@cialug.org">ciapug@cialug.org</a><br>&gt;<a href="http://cialug.org/mailman/listinfo/ciapug">http://cialug.org/mailman/listinfo/ciapug</a><br><br>_______________________________________________
<br>ciapug mailing list<br><a href="mailto:ciapug@cialug.org">ciapug@cialug.org</a><br><a href="http://cialug.org/mailman/listinfo/ciapug">http://cialug.org/mailman/listinfo/ciapug</a><br></blockquote></div><br>