Is there a way to dynamically and conditionally create a class definition in PHP, i.e.
if (condition matches)
include file containing class definition
else
class myclass extends ancestor_class { .................... }
without eval()?
My background is the accepted answer to this question. I am looking for the best way to build a ...
I've little experience with advanced OO practices, and I want to design this properly as an exercise. I'm thinking of implementing the following, and I'm asking if I'm going about this the right way.
I have a class PImage that holds the raw data and some information I need for an image file. Its header is currently something like this:
...
public class StepClause
{
public NamedStepClause Action1() {}
public NamedStepClause Action2() {}
}
public class NamedStepClause : StepClause
{
public StepClause Step(string name) {}
}
Basically, I want to be able to do something like this:
var workflow = new Workflow().Configure()
.Action1()
.Step("abc").Action2...
Grady Booch's "Object-Oriented Analysis and Design with Applications" is available brand new in both the 2nd edition (1993) and the 3rd edition (2007), while many used copies of both editions are available. Here are my concerns:
1) The 2nd edition uses C++: given that I just finished reading my first two C++ books (Accelerated C++ and C...
HI Guys, I've been working on a little experiement to see if I could create a helper method to serialize any of my types to any type of HTML tag I specify.
I'm getting a NullReferenceException when _writer = _viewContext.Writer; is called in
protected virtual void Dispose(bool disposing) {/*...*/}
I think I'm at a point where it alm...
Hey guys,
I'm learning myself to go from function based PHP coding to OOP. And this is the situation:
ClassA holds many basic tool methods (functions). it's __construct makes a DB connection.
ClassB holds specific methods based on a certain activity (extract widgets). ClassB extends ClassA because it uses some of the basic tools in th...
Hi Folks
note: I had originally posted a question similar to this here, but I decided to repost because I overcame the original issue and in the process, modified the design. I thought it warranted a new topic because as the design changed, the question fundamentally changed also. I just want to make it clear that I'm not trying to floo...
I have a class with an object as a member which doesn't have a default constructor. I'd like to initialize this member in the constructor, but it seems that in C++ I can't do that. Here is the class:
#include <boost/asio.hpp>
#include <boost/array.hpp>
using boost::asio::ip::udp;
template<class T>
class udp_sock
{
public:
...
Hello,
I'm no Java guy, so I ask myself what this means:
public Button(Light light) {
this.light = light;
}
Is Button a method? I ask myself, because it takes an input parameter light. But if it was a method, why would it begin with a capital letter and has no return data type?
Here comes the full example:
public class Butt...
I have a list of services which can be identified by names. Every service has a set of parameters (IP address, port, availability and so on). There are also method which can be applied to the services (close connection, open connection, send a message to the server, check if it is responding and so on).
So, I thought it is a natural app...
I'm looking for web sites, books, or other resources that provide a catalog of object designs used in common scenarios. I'm not looking for generic design patterns, but for samples of actual object designs that were used to solve real problems.
For instance, I'm about to build an internal messaging system for a web application, similar...
I need to do this:
(sorry not in javascript syntax-still learning object language :) )
object=car
attibutes:top-speed, brand....
now I want to sort the list of those cars in order by top-speed, brand...
How do I do this (please note the solution must be javascript only, no php or other stuff) ?
...
We have a serial port which is connected to hundreds of physical devices on the same wire. We have protocols like Modbus and Hart to handle the request and response between the application and devices. The question is related to managing the reference count of the channel. When no device is using the channel, the channel should be closed...
Which paradigm is better for design and analysis of algorithms?
Which is faster? Because I have a subject called Design and Analysis of Algorithms in university and have a time limit for programs. Is OOP slower than Procedure programming? Or the time difference is not big?
...
I have a large number of objects which are identified by names (strings). So, I would like to have a kind of mapping from object name to the class instances.
I was told that in this situation I can use a "repository" class which works like that:
Server myServer = ServerRepository.getServer("NameOfServer");
So, if there is already an ...
RDBMS are based on Relational Algebra as well as Codd's Model. Do we have something similar to that for Programming languages or OOP?
...
We have this situation:
Window Keyboard
^ ^
| /
ApplicationWindow
so
class Window { }
class Keyboard { }
class AppWindow : public Window, public Keyboard { }
Now, Keyboard wants to access a property in ApplicationWindow, for example,...
I was wondering, why do static Create methods exist?
For instance, why use this code:
System.Xml.XmlReader reader = System.Xml.XmlReader.Create(inputUri);
over this code:
System.Xml.XmlReader reader = new System.Xml.XmlReader(inputUri);
I cannot find the rationale for using one over the other, and can't find any relation between c...
I'm doing code review and came across a class that uses all static methods. The entrance method takes several arguments and then starts calling the other static methods passing along all or some of the arguments the entrance method received.
It isn't like a Math class with largely unrelated utility functions. In my own normal programm...
for example:
SortedSet EXTENDS Set
NavigableSet EXTENDS SortedSet
is the benefit finally gained at the bottom most level (one that actually implements)?.
In above case it would be TreeSet
Would it be fair to say that if some class is EXTENDING an interface then that class SHOULD/MUST be an interface?
...