I'm working with some code that adds a child node to it's parent in the child's constructor. The code looks something like this:
Class:
class Node1 {
public Node1(Node1 parent, String name) {
if(parent != null) {
parent.add(this);
}
this.parent = parent;
}
private void add(Node1 child) {
children.add(ch...
Can anyone tell me what design patterns (if any) were used when building Gmail? I understand the concept behind it - queue up some requests, increment the bar when each completes, init the display when all are down - but I'm specifically interested whether there's a specific design pattern I can use to mimic the features.
...
In C# Is there way to specify a class to be inherited only by a class present in the same assembly and for other assemblies should behave like a public sealed type.
...
Hi,
recently I had a job interview where I had to present self-written code and explain the programm architecture and design, had to take a look at company source code, explain what I understand of this source code sections presented (it was the domain model of an application) and had to modify the code to let the program work a little...
I was poking around in XNA and saw that the Vector3 class in it was using public fields instead of properties. I tried a quick benchmark and found that, for a struct the difference is quite dramatic (adding two Vectors together a 100 million times took 2.0s with properties and 1.4s with fields). For a reference type, the difference doesn...
This question is specifically regarding C#, but I am also interested in answers for C++ and Java (or even other languages if they've got something cool).
I am replacing switch statements with polymorphism in a "C using C# syntax" code I've inherited. I've been puzzling over the best way to create these objects. I have two fall-back meth...
I am learning about OCaml's OOP constructs and partially implemented this today until I realized I have no idea how to represent a polymorphic match statement without using the type keyword outside of the object.
class bar (param:string) =
object (code)
end;;
class foo param =
object (code)
initializer
match param with
string -...
Hi
I am getting started with OOP programming and would like to know what is the meaning of serialization in OOP parlance?
I am not a native english speaker hence the question.
...
In MVC, where is the correct place to put authorization code?
The controller?
The Model?
In the view?
All over the place?
...
"Abstraction and encapsulation are complementary concepts: abstraction focuses on the observable behavior of an object... encapsulation focuses upon the implementation that gives rise to this behavior... encapsulation is most often achieved through information hiding, which is the process of hiding all of the secrets of object that do no...
currently i am discussing if placing entity at the end of each entity is a good practice for example
public class CustomerEntity:BaseEntity{}
instead of
public class Customer:BaseEntity{}
in my career i had seen both, but how do you do it nowadays?
...
I'm soon going to be starting the development stage of my coursework and the current design is to have a single class that handles database connections and many classes that call it; the database class is supposed to open the connection and pass queries along blindly, other classes are responsible for the contents of those queries.
Wha...
I am trying to construct a rule-based system for interpreting data. However, I am having issues deciding on a way to construct the logic for storing and interpreting rules.
Currently, there is a database structure that quite complex, but will deal with all aspects of storing the rule data. The idea is that the system will be able to mim...
I recently attended an interview and they asked me the question "Why Interfaces are preferred over Abstract classes?"
I tried giving a few answers like:
We can get only one Extends functionality
they are 100% Abstract
Implementation is not hard-coded
They asked me take any of the JDBC api that you use. "Why are they Interfaces?".
C...
I'm currently reading up on OO before I embark upon my next major project. To give you some quick background, I'm a PHP developer, working on web applications.
One area that particularly interests me is the User Interface; specifically how to build this and connect it to my OO "model".
I've been doing some reading on this area. One of...
Hello everyone
I have an interface defined like so:
public interface IRipper
{
IRipperHost Host { get; set; }
void Rip(FileStream stream);
event RipperEventHandler OnStart;
event RipperEventHandler OnComplete;
event RipperEventHandler OnProgressChanged;
}
public delegate void RipperEventHandler(object send...
Scenario
You have an Assembly for Data Transfer Objects containing 10 classes that exactly represent 10 tables in your database.
You generate / build a DAL layer that has methods like -
DTOForTable1[] GetDataFromTable1();
DTOForTable2[] GetDataFromTable2();
and so on....
Question
How do I make a method that hides the numerous...
I'm trying to design a simple game ---Pong, Arkanoid--- using strictly "Proper OO", whatever that means.
So, by designing myself to death, I'm trying to get to a point where I'll know what to do or not do next time...
Who should handle, for example, colissions? And scorekeeping?
My first idea was giving a couple jobs to the ball, but ...
In a nutshell: how do I access the methods of a class that is instantiated by a method of a different class?
There is a bit of code I am looking at right now that does the following (altering the code is not an option, btw. It isn't mine... I'm just decipher it):
A class has a method that instantiates a different class. It looks someth...
To take an example, consider a set of discounts available to a supermarket shopper.
We could define these rules as data in some standard fashion (lists of qualifying items, applicable dates, coupon codes) and write generic code to handle these. Or, we could write each as a chunk of code, which checks for the appropriate things given th...