If I understand correctly, the typical mechanism for Dependency Injection is to inject either through a class' constructor or through a public property (member) of the class.
This exposes the dependency being injected and violates the OOP principle of encapsulation.
Am I correct in identifying this tradeoff? How do you deal with this ...
Hi!
I have a simple question about object oriented design but I have some difficulties figuring out what is the best solution. Say that I have an object with some methods and a fairly large amount of properties, perhaps an Employee object. Properties, like FirstName, Address and so on, which indicates a data structure. Then there could ...
i want to update a control based on a value e.g
if (StringName == StringName2)
ListBox1.Items.Add("send data");
else if (StringName3 == StringName4)
DifferentListBox.Items.Add("send data");
else if (StringName5 == StringName3)
AnotherListBox.Items.Add("send data");
// or do...
Is there difference between caching PHP objects on disk rather than not? If cached, objects would only be created once for ALL the site visitors, and if not, they will be created once for every visitor. Is there a performance difference for this or would I be wasting time doing this? Thank you :)
...
I have 2 tables in my database:
Category
BlogEntry
Each BlogEntry has 1 or more Categorys associated with it.
If I want to get a BlogEntry by its ID, I also want to get its Category information.
Maybe this example doesn't illustrate exactly a scenario where this would make sense, but say I want to load the Category ID and Name only...
I've done a bit of reading on data modeling recently and have a question about roles that an entity may play.
Consider a simple case where you've got a Company, and a Company can be a Supplier, Customer, Distributor, etc. or a combination of these roles. So company X might be both a Supplier and a Customer.
Down at the data level you ...
Is there difference between caching PHP objects on disk rather than not? If cached, objects would only be created once for ALL the site visitors, and if not, they will be created once for every visitor. Is there a performance difference for this or would I be wasting time doing this?
Basically, when it comes down to it, the main questio...
hi
I have a class like Employee. This class has some fields like Id,Name,Surname, Tasks( a string array) , isManager , TaskDueDates ( a date-time array).
I want to generate a text from this object.
I think to use seperators, this is a basic solution. For example my text can be: 13;George;Smith;{"Task1","Task2","Task3"},false, {this nig...
Hi,
I have 2 classes Test(Base)and Program(child). Now I am facing some problem while downcasting.
Test t = new Program();// upcasting-works
Program p = (Program)t;//Downcasting-works
Program q = (Program)new Test();//Downcasting -throws exception.
I want to know why its throwing exception? May b its very basic...
I'm looking for either a best practise or library for processing string into an object tree..
here is the example:
"[age] = '37' And [gender] Is Not Null And [optindate] > '2003/01/01' And [idnumber] Is Null And ([saresident] = '52' Or [citizenship] Like 'abc%')"
I should be able to objectize this into a tree something like this:
{at...
ECMAScript 5 is in final draft now, and includes new features relating to objects and prototypes. While hunting around SO and Google for OOP design patterns, I found that there were quite a few different ways of "doing OOP" (however you might define OOP, from trying to emulate classical OOP to simply trying to cut down namespace polluti...
Hello!
I need to use an object oriented data repository for a project.
It's going to be something between a wiki and a CMS.
I'm not an expert in the field of persistence yet.
I suppose Hibernate and Jackrabbit are the frameworks to go, right?
As far as I'm informed correctly, Jackrabbit does not support
annotations or other convenienc...
I have two php files in the same directory:
test.tattler.php
class.tattler_stats.php
My test.tattler is supposed to create an object of my tattler_stats but it gives me this error:
Fatal error: Class 'tattler_stats' not found in /.../test.tattler.php on line 4
Code in test.tattler:
<?php
include 'class.tattler_stats.php';
$tatt...
I want to redefine the ToString() function in one of my classes.
I wrote
public string ToString()
... and it's working fine. But ReSharper is telling me to change this to either
public new string ToString()
or
public override string ToString()
What's the difference? Why does C# requires something like this?
...
Edit 1
Is it possible to do this with get/set? Something like the below? This works for me but I am worried I am missing something not to mention all the staticness.
///<summary>
/// Class to track and maintain Heads Up Display information
///</summary>
public static class HUD
{
///<summary>
///Declare variables to store HUD ...
In subsystem design, I sometimes see software designs that have one high-level class that has only one feature: It routes a call from a client using the class to another a certain class the client would like to use. However, it alone does not have any functionality. Take this scenario:
Say there are five classes in the bowling alley sub...
I have a class which initiates another class, i'm not concerned with having a reference to the object i only need the method and have to pass in new parameters.
class A {
__set .....
}
class B extends A {
$anotherA = new A;
$anotherA->myName = 'stackoverflow';
}
in short i'd like to have class B extend A, init a new in...
I'm developing a small project in ASP.NET MVC to manage photos, but I don't know how to organize my classes in namespaces.
I have 2 base classes (Photo and Category). Should I put these classes into which namespace? Domain? POCO/POJO?
For Data Access, I have more 2 classes, PhotoDAO and CategoryDAO in DAO namespace. (Is it right?)
Whi...
Lets say I want to design a abstract system for counting sections in a document. I designed two classes, Document and Section, the document has a list of sections and a method to count them.
public abstract class Document {
List<Section> sections;
public void addSection(Section section) {
sections.Add(section);
}
public in...
I want to isolate database code from GUI design. For a reasonable time I've been reading/searching/skimming on topics like mgm/mvp/mvc/persistence/objects etc.
I really have difficulty in designing a reusable object hierarchy/framework. Delphi is a great tool for RAD but when you want to work things out in a different way the documentat...