oop

How to design a program (structure and literal file/folder structure) for the real world? (Specifically C#)

How would one create, or where could one find an example of a relatively simple C# program that is big enough to require multiple classes and files and demonstrate medium complexity of OOP based interactions? Some examples would be great. There are a lot of resources out there, and I am familiar with OOP syntax and concepts, but is see...

How to teach Object Oriented Programming - Any idea where to start ?

I'm teaching C++ for about 2 years in high schools, computer training institutes and etc. After teaching basics about variables, arrays, structures, functions, I always start object oriented examples part with traditional examples, like this one: class Person { public: Person(); ~Person(); char* getFirstName(); //we can use std::st...

Expose members in a data structure like class?

For the use in a Servlet based application I've written a class to store a view name and objects to be rendered. Actually it is more a data structure than a class in the sense of OOP. I wonder if I should expose the members or if should use getters. public class Result { private final int status; private final String view; ...

Can we have a "not override a concrete method ..." compile time error when implementing interfaces ?

Can we have a "not override a concrete method ..." compile time error when implementing interfaces ? An example to be more clear : I build up a framework containing interfaces. To use the framework developers need to implements some interfaces. But if they don't override equals(Object object) and hashCode() Object methods the internal ...

How should classes be structured internally as regards methods and their use of instance variables?

I keep having problems deciding how I should create my classes internally. Initially I would have an external class handle all the variable management: String destination = car.setDestination("San Fransisco"); int totalGas = car.getAmountOfGas(); int requiredGas = car.gasRequiredForDestination(destination); boolean enough = car.hasEnou...

"Program to an interface". What does it mean?

Hi, I keep coming across this term "Program to an interface" What exactly does it mean? A real life design scenario would be highly appreciated. Thanks ...

Does dependency injection increase my risk of doing something foolish?

I'm trying to embrace widespread dependency injection/IoC. As I read more and more about the benefits I can certainly appreciate them, however I am concerned that in some cases that embracing the dependency injection pattern might lead me to create flexibility at the expense of being able to limit risk by encapsulating controls on what ...

Classes. Whats the point?

I'm fairly new to OOP in PHP, I've made a couple of basic scripts but nothing impressive. All I've really taken from it is that it would probably be easier just make a collection of functions and include them. The structure of classes seems to just confuse what was otherwise a simple process. And in collating everything into a class it...

Where's the best samples of Microsoft for developing c# win-based programs which connect to SQL Server Data base?

Hi all I searched within Microsoft web site. But you know, there were lots of samples and I didn't know which one is suitable for my purpose. I'm looking for the best samples of Microsoft for developing c# win-based programs which connect to SQL Server Data base. What I mean is, samples which use OOP concepts, use .NET 3+ features.... C...

Design issues - observer,factory, composition and more

Hey, So i need to design something like that : I have a spreadsheet which can contain numerous sheets (maybe of different kinds). each sheet has let's say 1A-9Z cells. in each cell i can have one the above : String, Number, Formula - which means the cell gets an operation like +,-,/,* etc... and cells numbers, and in the cell i have ...

While(1) in constructor or using threads?

Is it recommed to put a while loop, which never ends in a constructor? Or should I use threads to get the same result? Is it good when a constructor never terminates? Or is it more secure to avoid segmentation faults? Hope you understand my bad English.. ...

What is the best OOP approach to implement the best Category and Products relationship using PHP?

I am trying to design a PHP project's structure. What I am not very sure about is how to implement categories and products relationship. A category has one parent, and can have many children. Product belongs to only one category. Db tables are like this: products: id product_name category_id categories id category_name parent_id ...

How Bad Are Singletons?

So .... There are obviously many questions that all have been asked about Singletons, Global State Variables, and all that great stuff. My question is, If Singletons and Globals are So Bad, Why are they used so often? The following examples are simply ones off the top of my head that I believe are used by a good chunk of people. I g...

How to separate visibility of methods through two layers?

I have an DataMapper class which has some private and public methods. The DataMapper class itself is in the system layer because it is auto-generated code. The user (developer) uses the DataMapper class in the domain layer (or business logic layer). There are some methods of the DataMapper which are used only by the framework, and which...

Architectue of a huge application. To share or not to share code between modules.

A huge application, new modules are added every few months, 5-10 programmers. Some modules access the same tables, some modules use (currently) the same queries. My question, would it be smarter to make each module a 100% stand alone application, with it's own DAL classes and BL classes (library classes, ZF, are shared, ofcourse), or sho...

what is the use of character stream in java?

what is the use of character stream in java? why we need while there is byte streams?I hav gone through many sites i dint get it clearly...Please make me clear...please dont paste google results ...

Object Orientation, Rails.

I was asked this question, "How do you see Object Orientation in terms of rails?". What would be a perfect answer for this in an interview? ...

dotnet HL7 integration library

Hi All, I have a medical health database that a 3rd party needs to connect to. We need to look at using the HL7 standards. I am looking for a good library to make using HL7 easier in a dotnet enviroment. I will need a comprehensive 2.x and 3.x lib that can do most of the heavy lifting. I want to try and avoid using message parsing a...

Question about functional OOP style in JavaScript

I prefer to use functional OOP style for my code (similar to the module pattern) because it helps me to avoid the "new" keyword and all problems with the scope of "this" keyword in callbacks. But I've run into a few minor issues with it. I would like to use the following code to create a class. namespace.myClass = function(){ var sel...

How can I get the instance that created another object's instance in php?

Hi guys, I need to track which instance created another instance. It's an instancing hierarchy not a parent-child class hierarchy. Here's an example: class Car{ private var $engine; private var $id; public function __construct(){ $this->id = nextId(); $this->engine = new Engine(500); } } class Engine{ ...