Is there a notion of object-private in any OOP language ?? I mean more restrictive than the classic private access ?
Private (or class-private) restricts the access to the class itself. Only methods that are part of the same class can access private members.
object-private : restricts the access to the object itself. Only methods objec...
I want to solidify my understanding of the "coding to interface" concept. As I understand it, one creates interfaces to delineate expected functionality, and then implements these "contracts" in concrete classes. To use the interface one can simply call the methods on an instance of the concrete class.
The obvious benefit is knowing of ...
I'm looking at this java web application that is using hibernate, jsp's, and spring framework. (from what I can tell!)
the file layout is like this:
classes/com/example/project1
inside project1
/dao
_entity_Dao.java
/dao/hibernate/
_entity_DaoHibernate.java
/factory
DaoFactory.java
DaoFactoryImpl.java
/managers
...
I really am clueless when it comes to object-oriented programmings, so forgive me if this is obvious...
I am using a Zend extension which returns a request as a nested object. I need property a based on if the object has property b. Right now I am using a foreach loop with a conditional to search for property b and, if I get a match, se...
I'm trying to confirm now, what I believe about the Data Mapper pattern. So here we go:
Section A:
A Data Mapper is a class which is used to create, update and delete objects of another Class. Example: A class called Cat, and a Data Mapper called CatDataMapper. And a database table called cats. But it could also be an xml file called ca...
I've almost finished my Data Mapper, but now I'm at the point where it comes to relationships.
I will try to illustrate my ideas here. I wasn't able to find good articles / informations on this topic, so maybe I'm re-inventing the wheel (for sure I am, I could just use a big framework - but I want to learn by doing it).
1:1 Relationshi...
And here i am again! ;)
Im developing (well, im still in planning phase) a web-app where i would give to other developer the possibility to write theyr own plugins/modules (in the way of CMS does, drupal, joomla, etc).
My problem is that i have to force the developers to use the methods i wrote for interact with databases, for many rea...
A subclass needs to know when particular events occur withing its superclass, but there are more than one ways for the superclass to break the news. Here are 2:
dispatch an event
call an abstract method which the subclass could eventually override
I was wondering if best practices would recommend one of the approaches over the other....
Hi Guys, I'm trying to build my own learn path to understand OOP for web development mostly with MVC Frameworks under PHP.
My big problem is that I'm a COBOL programmer and it not seems to hard for me understand web technologies such as PHP, my worst enemy is OOP programming .. Comming from an Structured Language such as COBOL it's is h...
A little intro:
Class contains fields and methods (let me skip properties this time).
Fields represent a state of the class.
Methods describe behavior of the class.
In a well-designed class, a method won't change the class's state if it throws an exception, right? (In other words, whatever happens, class's state shouldn't be corrupted)...
In Java (well, Android's version at least) all objects have a getClass() method which returns the object's class and you can then call getSimpleName() to get the human-readable name of the object. This is great for logging. I'd like to be able to do something similar in a PHP program I've been working on. Is there any way to find out wha...
I work at a web development shop so naturally we deal with user profiles. When dealing with one of our sites I noticed that there was no 'User' class, which struck me as odd since we certainly have users. Instead the site relies on interacting with DataRows (this is C#) returned through static methods with little to no instantiation. ...
Still on the PHP-OOP training wheels, this question may belong on failblog.org. =)
What are the benefits of method chaining in PHP?
I'm not sure if this is important, but I'll be calling my method statically. e.g.
$foo = Bar::get('sysop')->set('admin')->render();
From what I've read, any method which returns $this is allowed to be c...
I've tried to develop a 2D game with C++ in the past using mere objects, however, in the design process I don't know how and what parts of the engine I should split into smaller objects, what exactly they should do and how to make them interact with each other properly. I'm looking for books, tutorials, papers, anything that explains the...
Asp.net-mvc, using nhibernate.
my vs.net layout is like:
/dao (1 class per entity for database work, using repository)
/model
/mappings
/factory (db factory that provides access to each entities Dao)
Now I need utility methods, not sure where to put them.
example:
CartItems.cs
CartIemsDao.cs
Now say I have a method like:
ILi...
In Martin Fowler's Patterns for Enterprise Application Architectures book (page 229 in German, Lazy Load) he gives an example with this code:
public List getProducts() {
if (products == null) products = Product.findForSupplier(getID());
return products;
}
like you can see, the finder method seems to be part of the domain class...
Hi All,
I am using c# & .NET 3.5. A vendor gives us an object that has properties of UserVarNbr1, UserVarData1, UserVarNbr2, UserVarData2,... UserVarNbrN, UserVarDataN. Not the way I would have coded it but nonetheless, this is what we have to work with. Another object in the application returns a collection of items used to represent th...
Basically is the only advantage of object oriented languages the improved understanding of a programs purpose?
Do the compilers of object oriented languages break apart the objects into structures and function libraries?
...
I have a method where performance is really important (I know premature optimization is the root of all evil. I know I should and I did profile my code. In this application every tenth of a second I save is a big win.) This method uses different heuristics to generate and return elements. The heuristics are used sequentially: the first h...
Let's say I have an abstract class called ViewController, and another abstract class called FormViewController. When someone wants to create a form, he must subclass FormViewController and implement its abstract classes.
ViewController defines an abstract method loadView() and viewDidLoad(). FormViewController implements loadView() but ...