oop

.NET Airplane Simulator

Use Case Name: Start airplane simulation Scope: Airplane Flight Simulator Level: User goal Primary Actor: User User starts Airplane simulator Ask the user for a maximum height(ceiling) Ask the user for a minimum height(floor) Airplane simulator begins from an airborne position, no takeoff or landing Airplane ascends to maximum heigh...

One parent object for multiple child objects.

Is it possible to have one parent object for more than one child object so that all the child could share the same parent state? ...

How not to implement a function of an interface in class?

An interviewer asked me the following question in interview, but I don't know what could be the answer of this question, please help!!! What must be done if i don't want to implement a function in my class that is declared in an interface which is implemented by my class. Edited: I am using .NET with C#. It will be great if a...

Is this a known pattern?

I am trying to separate behaviour from data completely in my classes and came up with this simple solution: class ClassAData { public int Property1; public string Property2; public bool Property3; } class ClassA : SomeInterface { public ClassAData Data; //behaviour public int CalculateSomething(int value) {...

.NET Project Architecture

Hi, I have sort of a philosophical question, which also need to consider the performance impact. We are designing a new system with many sub-services that are not related to each other, yet, some may use each other (We are using unity to avoid any decoupling). My main question is: Should we break them into separate DLL's, where each ...

Is authentication a concern of my domain or of my application?

I'm trying to design the authentication of my web application in an object oriented manner. Is this a concern of my domain in which case I would have something like this: $user->authenticate($authenticator); $user->login($authenticator); Where $authenticator is an interface to my authentication service. Or would this be a cross cutti...

c++ / object-oriented quick review?

I am looking for quick reference guide(s) for both OO and C++. I have a few technical interviews coming up and I just want a quick reference that gives the basic overview of the fundamentals. (Nothing too in depth, as I've learned it all once before) ...

Hibernate OO Design Question

I'm working on creating a Hibernate query engine that can create dynamic queries. Thus far I've been using the Criterion API to generate the queries. I'm having a hard time writing the engine in an OO fashion. I want to be able to create a new class for each association and have it pass back a fragment of the SQL call. For example: ...

Is is possible to override a hidden method?

Say I have the following hierarchy: public class MyClass { protected virtual void Method() { ... } } public class MySubClass : MyClass { public new virtual void Method() { ... } } public class MySubSubClass : MySubClass { // how do I reference the protected Method() to override it? } Is it possible to override the implementati...

Java: Static Class?

I have a class full of utility functions. Instantiating an instance of it makes no semantic sense, but I still want to call its methods. What is the best way to deal with this? Static class? Abstract? ...

Refactoring a method containing conditional with extremely different code blocks that are the same ;)

So I have this stinky method, the two conditional blocks do almost the exact same thing, but with radically different parameters (at least in my eyes). I want to clean it Uncle Bob style, but can't for the life of me figure out a tidy way of doing it. So I come to you, my fabulous nerd friends, to see how you might distill this down to s...

javascript oo question

Hi, I have a html page like this <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <script src="JScript2.js" type="text/javascript"></script> <script src="JScript.js" type="text/javascript"></script> <title></title> </head> <body > <div ><input type=text id="uxTextBox" /></div> </body> </html> and 2 javascript fil...

C# using the "this" keyword in this situation?

Hi, I've completed a OOP course assignment where I design and code a Complex Number class. For extra credit, I can do the following: Add two complex numbers. The function will take one complex number object as a parameter and return a complex number object. When adding two complex numbers, the real part of the calling object is adde...

Entity names vs table names

We are going to develop a new system over a legacy database(using .NET C#).There are approximately 500 tables. We have choosen to use an ORM tool for our data access layer. The problem is with namig convention for the entities. The tables in the database have names like TB_CUST - table with customer data, or TP_COMP_CARS - company cars....

advice on my DAL layer, any obvious issues with it?

I am using nHibernate. My classes are POCO, that map 1:1 with my database tables. I created a IGenericDAO -> GenericDAO that does all my basic CRUD. (repository) Each table has a DAO class, so: public class UserDAO : GenericDAO Any table specific queries will go in the tableDAO class. I then have a factory, IDAOFactory. public class ...

How can I have both abstract and virtual methods in one class?

In the following parent class SqlStatement, how can I make Initialize() abstract but keep Execute() virtual? using System; using System.Collections.Generic; namespace TestSql28374 { class Program { static void Main(string[] args) { object item = new object(); List<string> properties = new...

Calling a Child class' method when processing a list of Parent class objects

This question seems like it might be somewhat common, but I didn't find anything when scowering StackOverflow or the interwebs. I came across a method in a C++ class that takes a list of (for example) Parent objects. For this example, assume that there are two classes that derive from Parent: Child1 and Child2. For each object in the...

Organising top level functions in a Javascript file

Occasionaly we will have a page that required some page specific Javascript functionality. I will create a javascript file called myPageName.js. The question I have is how do people organise their top level functions. I currently have 15+ top level functions defined like this function function1 (containerElement) { ...do function1;...

How do I pass a reference to the outer class to a method in an inner class? ( Or how do I pass "this" to an inner class? )

I have a class as follows: private class LanePair { public int cameraNumber; public Nest nest1, nest2; public LanePairStatus status = LanePairStatus.TIMER_OFF; Timer timer = new Timer(); public LanePair(int cameraNunber, Nest nest1, Nest nest2) { this.cameraNumber = cameraNumber; this.nest1 = nest1; this.nest2 = nest2; } ...

Difference between a factory, provider and a service?

What is the difference between the terms factory, provider and service? Just getting into nhibernate and its repository pattern (POCO classes, etc). ...