Is it possible to do something like this?
public function something() {
$thisMethodName = method_get_name(); // I made that function up, but is there some way of doing what it describes?
}
Thanks
...
Can a class return an object of itself.
In my example I have a class called "Change" which represents a change to the system, and I am wondering if it is in anyway against design principles to return an object of type Change or an ArrayList which is populated with all the recent Change objects.
...
Consider a production planning application with many products. Each product has a list of InventoryControl objects keyed on InventoryControlType. Depending on the algorithm we run for production planning, we need to access to different types of InventoryControl objects for a given product. This works OK. However, today I needed to introd...
Hi All,
I'm creating a java program that creates a file and fills it with data in string form with each field in the record limited to a specific length.
What I think I need to do is to create a class that has a string for the data field and a length specifying the length of the string. And then somehow restrict it so that the string n...
I'm looking for inspiration on how to design classes from scratch in a project with multiple developers in different locations (so no whiteboard sessions.)
Let's say you're tasked with implementing a rather big feature that is going to be used by the other developers later in the project. This feature will require several classes and wi...
DatePeriod is a PHP class for handling recurring dates. It has a very limited number of methods. So when I want to do basic array functions with the recurring dates, I have to copy it to an array with iterator_to_array. Strangely, copying it seems to clobber it. Any ideas why?
$p=new DatePeriod(date_create('2008-01-01'),
...
For an unknown reason, VB6 doesn't interact the same way with UserControl than other object.
I have a class that require to hold a graphical interface, a user control and need to be set to be later used from the get method. I have try many thing like using the special class VBControlExtender but without any success.
Here is what I have...
I want to be able to create and unknown number of objects. I'm not sure if there is a better way to manage and reference them.
Lets use a standard OOP example... say every time a user enters a name for a pet in a text field and clicks a button a new pet object is created via the petFactory function.
function pet(name)
{
this.nam...
What would be the best way to structure orders for a restaurant (available languages are php and javascript)? Since there are multiple tables (the ones you keep things on...), I thought of using objects in javascript. But I am quite new to javascript and absolutely new to OOP, so I'm not sure whether this is the best solution, and whethe...
I'd like to write a small JavaScript (framework) that can chain functions with all following functions being aware of the data of its predecessor.
Basically, I'm not interested in the bloat (I realize it's small, for my even smaller project though it's bloat) that jQuery provides but would like to mimic some of its behavior -- primarily...
I have a view
ViewUserControl<SearchViewData>
where
SearchViewData: CommonViewData
In this view I thus have a reference to Html.
This is of the type HtmlHelper<SearchViewData>
I create a custom HtmlHelper class called CommonHtmlHelper where I want to this (note the HtmlHelper parameter's type):
public static SelectList Translat...
Hi All
What is the best way of creating and populating an Object from values passed in from a form?
If for example, i have a class Car with properties Colour, Model, Make, Year and a method Save, which will either insert or update the record.
I then have a form that has fields for all these values and it is submitted. I want to create...
I am importing legacy C++ code using Rhapsody. One class has many (several dozen) attributes I'd rather see imported as separate classes. I've tried different "options" settings with no results. Is there a way to do this, other than redo all by hand?
...
Are C# lists fast? What are the good and bad sides of using lists to handle objects?
Extensive use of lists will make software slower? What are the alternatives to lists in C#?
How many objects is "too many objects" for lists?
...
Most of you should know that 'famous' article about "Writing Robust PHP Backends with Zend Framework"
After an insteresting reading, i decided to give it a try, since i couldn't be able to find the gold solution to handle my datas.
Then, i tried to write kind of a skeleton, to have a concrete example.
But some points looks weird for m...
Over the past few years I've been on projects where we've run into a similar problem in our object hierarchy that always seems to cause problems. I was curious if anyone here knew of a classical OOP (Java, C#, PHP5, etc) design pattern that could gracefully handle this situation.
Say we have an existing system. This system has, among ...
I've around 80 instances of this class called Items and would like to efficiently search the objects by their ID or NAME.
<?php
class Item
{
public $id;
public $name;
//methods
}
?>
I'm using PHP5.
...
I read about virtual constructors are used for implementing some design patterns, but didn't understood any need of virtual constructors. So what are virtual constructors and why we really need them?
...
i have something like this in my project, the project it's kinda finished already (it's working)
i just want know if it is ok with the SOLID principles
static public class Tools
{
static public GetProduct(this id){...}
static public GetProductCategory(this id){...}
static public GetUser(this id){...}
// I also have h...
// base function
function Man(name) {
// private property
var lover = "simron";
// public property
this.wife = "rocy";
// privileged method
this.getLover = function(){return lover};
// public method
Man.prototype.getWife = function(){return this.wife;};
}
// child function
function Indian(){
var lover = "jothika";
t...