I'm evaluating some potential implementations of a complex object hierarchy model for my current project. I'm wondering if there is an xpath-style meta-language or something like this that would allow me to query these object linkages.
Furthermore, I'm sure there is some very specific jargon used for the problem I am asking about - I ju...
Hi,
We have services which are either Educational Cess only, Taxable, Non-taxable. Taxes can further be of the following types: Fringe, Sales, Excise, Octroi, Educational Cess, Subsidy, Other Local taxes.
We are planning to implement the calculation of taxes using a visitor. What would be the best choice for the Visitable class/interfac...
Hi,
Is it acceptable for interfaces to declare properties instead of methods?
Which is more preferred?
interface ITaggable { string GetTag(); }
or
interface ITaggable { Tag {get;} }
Living in the .Net world.
Kind regards,
...
I'm working on some effects and things to get a handle on Classes/Implements/Extends. The examples here are for the base classes (MooSlidesFx, MooSlidesFx.Elements) from which to create many effects with a project I'm working on, and two child class (MooSlidesFx.Fade, MooSlidesEffects.Elements.Fade) that actually do something.
http://pa...
How should I refactor this design?
class Service : IChargeable, IExtendable<br />
{
}
interface IChargeable
{
decimal? ChargeableAmount {
get;
}
}
interface IExtendable
{
bool IsExtendable {
get;
}
}
class DayService : Service { }
class NightService : Service { }
class TwentFourService : Service { }
The probl...
Files and directories could have different namespaces, and still be used to identify specific files, because a file and directory with the same name can be distinguished by being different kinds of things.
Primitive field and reference fields could also have different namespaces (in Java), because if a primitive and a reference field ha...
I would like to experimentally apply an aspect of encapsulation that I read about once, where an entity object includes domains for its attributes, e.g. for its CostCentre property, it contains the list of valid cost centres. This way, when I open an edit form for an Extension, I only need pass the form one Extension object, where I nor...
Hello,
I have been using the clone keyword to duplicate objects like so:
$x = clone $obj;
as per the manual.
This works fine when accessed by browser. phpinfo() reports PHP version 5.2.6.
However when run by cron or from the CLI I get
"Parse error: syntax error, unexpected T_VARIABLE" from the clone keyword.
php -v reports P...
I want a nice way to get the current unix timestamp from a java Date object, this is my solution:
public class Date extends java.util.Date {
public int getUnixTimeStamp() {
int unixtimestamp = (int) (this.getTime() * .001);
return unixtimestamp;
}
}
That works fine, but the problem is when I try to cast a java...
I have a Logging class which gets instantiated on startup of a console app and the stored in a static variable.
If i want a class to use the logger should it be passed to the class in the constructor or referenced directly?
I'm trying to write unit tests and either way i should be able to do it. Just means i have to set the static vari...
Assuming I have the superclass A, and the subclasses A1 and A2 which inherit from A, how could I get the subclass type of the variables in the code below?
A _a1 = new A1();
A _a2 = new A2();
// Need type of A1 and A2 given the variables _a1 and _a2.
Also, if I had another subclass A2_1 which is a sublcass of A2, how do I get the lowes...
Hi all,
first question here, so hopefully you'll all go gently on me!
I've been reading an awful lot over the past few days about polymorphism, and trying to apply it to what I do in c#, and it seems there are a few different ways to implement it. I hope I've gotten a handle on this, but I'd be delighted even if I haven't for clarific...
At the risk of being flamed... what advantage does enforcing calls to methods rather than functions have in a context where the context is implicit.
Considering that PHP's syntax is so ugly for calling methods why would PHPUnit's creators have enforced its usage?
If the framework had set a global "currentTestCase" object and then trans...
Given this class:
class Tacobell{
public function order_taco(){
echo "3 Tacos, thank you.";
}
public function order_burrito(){
echo "Cheesy bean and rice, please";
}
}
$lunch = new Tacobell;
$lunch->order_burrito();
$lunch->order_taco();
How would I do something like this?
$myOrder = 'burrito';
$lunch->order_.$myOrder;
...
Hi,
What is the best approach for defining Interfaces in either C# or Java? Do we need to make generic or add the methods as and when the real need arises?
Regards,
Srinivas
...
I'm just getting a bit confused about all the language types out there. What's the difference - if there is one - between the high level / low level languages distinction compared to the object-oriented / procedural distinction? A lot of the analogies seem similar.
...
Hello everyone,
my question is rather a design question.
In Python, if code in your "constructor" fails, the object ends up not being defined. Thus:
someInstance = MyClass("test123") #lets say that constructor throws an exception
someInstance.doSomething() # will fail, name someInstance not defined.
I do have a situation though, wher...
How would I model such a situation? How should the database be designed? What classes should I have?
Problem Statement: Each employee belongs at least to one project, each project has many tasks, each task is assigned to at least one employee.
I should be able to churn out
the employees working on a project.
the tasks that belong t...
Lets say that one has a class like Person that has associated with it some default settings implemented in a Setting class. Those settings might be things like "Default Title" or "First Name Required". Correspondingly, other classes like an Address class might also have some default settings. The Setting class persists each setting in...
I want to call InvoicingAndDelivery.report_lines, then give me an array of those results, but it isn't working. Any ideas?
class InvoicingAndDelivery < Report
include DateExtentions
attr_accessor :report_lines, :tba_line, :sum_line
def initialize(part_or_service_ids, start_date, to_date)
# @report_lines = []
number_of...