griffithinfotech / quickb2

Automatically exported from code.google.com/p/quickb2
0 stars 0 forks source link

Protected methods instead of Private #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please change private methods to protected so one can extend them properly, ie. 
tried to extend qb2TripSensor but couldn't, and had to make a copy of it and 
modify the code in order to get it to do what I want. It would really help a 
lot.

Original issue reported on code.google.com by t.wisnie...@gtempaccount.com on 20 May 2011 at 6:55

GoogleCodeExporter commented 9 years ago
If a method is private, there's usually a compelling encapsulation reason.  
qb2TripSensor in particular can be extended by adding event listeners in the 
subclass.  All of qb2TripSensor's private methods exist only to dispatch events.

Let me know if there's some behavior that you cannot extend by using event 
listeners.

Original comment by doug...@gmail.com on 22 May 2011 at 4:54

GoogleCodeExporter commented 9 years ago
well, I needed a contactPoint so sensor couldn't be ghost.

Original comment by t.wisnie...@gtempaccount.com on 22 May 2011 at 9:53

GoogleCodeExporter commented 9 years ago
You can just set the sensor to isGhost=false.

What's the specific reason for copying and pasting the whole qb2TripSensor 
class (or extending it)?  I'm not saying there definitely isn't a reason, but I 
just don't understand what the problem is.

Original comment by doug...@gmail.com on 23 May 2011 at 2:01

GoogleCodeExporter commented 9 years ago
hmm, you know, you are quite right, it's so obvious I have to knock myslef on 
the head into thinking straight again. ;/

Original comment by t.wisnie...@gtempaccount.com on 24 May 2011 at 8:02

GoogleCodeExporter commented 9 years ago
Hey, no problem...let me know if you have similar troubles extending other 
classes (or this class).  For sure there are other classes in the library that 
will have some problems with extending that I need to fix.  In general, I try 
to make everything very encapsulated, so events are used in many places instead 
of overridable protected methods.

Original comment by doug...@gmail.com on 24 May 2011 at 1:49