I've been reading up on this "Law of Demeter" thing, and it (and pure "wrapper" classes in general) seem to generally be anti patterns. Consider an implementation class:
class FluidSimulator {
void reset() { /* ... */ }
}
Now consider two different implementations of another class:
class ScreenSpaceEffects1 {
private FluidSim...
Hi,
is it possible to do something like this in PHP 5.2.1?
abstract class Test
{
public function __construct()
{
if (function_exists('init')):
$this->init();
}
}
If i try this, the function on the subclass is not called?
...
Hello, I'm working my way through an exercise to understand Java, and basically I need to merge the functionality of two classes into one app.
I'm stuck on one area though - the referencing of objects across classes.
What I have done is set up a gui in one class (test1), and this has a textfield in ie.
chatLine = new JTextField();
i...
Using a facade controller pattern in .net. It seems as if though it is not efficient BECAUSE, for every event that happens in a domain object(Sales, Register, Schedule, Car) it has to be subscribed to by the controller(use case controller) and then the controller in turn has to duplicate that same event to make it available for the prese...
By any means, is it possible to create an instance of an php class without calling its constructor ?
I have Class A and while creating an instance of it am passing file and in constructor of Class A am opening the file.
Now in Class A, there is function which I need to call but am not required to pass file and so there is not need to ...
Really newbie question coming up. Is there a standard (or good) way to deal with not needing all of the information that a database table contains loaded into every associated object. I'm thinking in the context of web pages where you're only going to use the objects to build a single page rather than an application with longer lived obj...
I'm hoping to call a "static" dictionary function using call(). By "static" I mean that the keyword 'dict' is not used in the function's definition. I use this nomenclature in the hopes that the effect of this keyword is to declare a static member function as is possible in java/C++/etc, ie to put the function name in the class namespa...
I am confuse between the best way to organize dependency between multiple classes
assume i have the following classes
Employee,
Salary,
DataAccess
Should i go for:
Option1
Employee emp = new Employee();
Salary sal = new Salary();
DataAccess data = new DataAccess();
sal.Calculate(emp);
data.Save(emp);
or Option2
Employee emp = n...
I recently read that getters/setters are evil and I have to say it makes sense, yet when I started learning OOP one of the first things I learned was "Encapsulate your fields" so I learned to create class give it some fields, create getters, setters for them and create constructor where I initialize these fields. And every time some othe...
All,
I'm going through the Friedman & Felleisen book "A Little Java, A Few Patterns". I'm trying to type the examples in DrJava, but I'm getting some errors. I'm a beginner, so I might be making rookie mistakes.
Here is what I have set-up:
public class ALittleJava {
//ABSTRACT CLASS POINT
abstract class Point {
abstract ...
I was planning to use db4o for a website. It's a microblog site with small posts and comments developed in java.
The thing is I contacted db4o support asking if db4o would be suitable for a website, and they answered me that only for websites with low concurrency. That means with few requests?
So, now I think db4o will not be a good...
Is the nesting of functions possible in the object oriented languages like C#, Java, C++ etc . If so, can anyone give an example?
...
I have to do an export from DB to CSV. (.NET 2)
field; fileld; field... etc
Have 3 types of fields: Alpha, Numeric and Bool respresented as "alphaValue",intValue and True/False.
I try to encapsulate this in a fields collection, in order to export if alpha then set "", if Bool=>True/False if numeric let as is.
and try to build a CsvF...
Hello,
I have two websites that have an almost identical database schema. the only difference is that some tables in one website have 1 or 2 extra fields that the other and vice versa.
I wanted to the same Database Access layer classes to will manipulate both websites.
What can be a good design pattern that can be used to handle that ...
I know that private instance variables are accessed through their public getters and setters method.
But when I generate constructors with the help of IDE, it initializes instance variables directly instead of initializing them through their setter methods.
Q1. So should I change the IDE generated code for constructors to initialize th...
I have always wondered what's the best way to achieve this task. In most web based applications you have to provide search options on many different criteria. Based on what criteria is chosen behind the scene you modify your SQL. Generally, this is how I tend to go about it:-
Have a base SQL template.
In the base template have conditi...
Do any web 2.0 like websites exist for prototyping object oriented class diagrams?
...
Hello, I wonder if anyone can help - I have this error showing recently when debugging in eclipse - what doe it mean by resource, an imported package or the location of some java files ?
Can't find resource for bundle sun.awt.resources.awt, key AWT.EventQueueClass
MissingResourceException (id =45)
I also get an option to "edit source ...
Is it considered better practice and/or more efficient to create a 'reset' function for a particular object that clears/defaults all the necessary member variables to allow for further operations, or to simply construct a new object from outside?
I've seen both methods employed a lot, but I can't decide which one is better. Of course, f...
I need to get the number of rows of a query (so I can paginate results).
As I'm learning codeigniter (and OO php) I wanted to try and chain a ->num_rows() to the query, but it doesn't work:
//this works:
$data['count'] = count($this->events->findEvents($data['date'], $data['keyword']));
//the following doesn't work and generates
// Fa...