oop

Accessibility Levels: What is the difference between protected and private

Hi, I am newbie in C#. Could you please help me to understand the difference from a private method and a protected one. Following http://msdn.microsoft.com/en-us/library/ba0a1yw2%28v=VS.71%29.aspx I am not able to understand it, specially the phrase "Private: Access is limited to the containing type." Thanks for your help. Bye! ...

How to define interface method with diffferent arguments in AS3?

Hi! I'm trying to define interface in which one method (initPage) needs to have different arguments in every implementation. How can I do this? Using ...args for me is not good, because I'm loosing strong type checking. public interface IPage { function initPage(...args):void; function showPage():void; function hidePage():vo...

What is an appropriate name for a class which can store some object in an xml-file and read it back?

I have a class which is called TestPlan (to put it simple, let's assume that it's a usual java bean). I need to store TestPlan instances in xml-files (1 instance per file). The most appropriate way to do it which I can see is using another class which should do only xml-related work. It'll have methods like: public TestPlan parseTestP...

AS3 OOP Game Development Structure

Hello, I'm wondering what is the best practise for gamedevelopment for actioncript 3. I'm currently in the progress of creating a tile-based game, but I'm already having some troubles using seperate classes. This is the current situation: Main class Generates the tiles Adds player class Adds interface class The interface class con...

How to create class objects dynamically?

Let's say I have a class box, and an user can create boxes. How to do it? I understand I create objects by className objectName(args); but how to do it dynamically, depending on the user input? ...

OO design and circular dependencies

I am currently struggling with a circular dependency problem when designing my classes. Ever since I read about the Anemic Domain Model (something I was doing all the time), I have really been trying to get away from creating domain objects that were just "buckets of getters and setters" and return to my OO roots. However, the problem...

Howto move from object based language to server side Node.js Javascript for big projects?

Hi there, I've decided to get used to using Javascript as my server sided (I'm using Node.js) language to setup a webserver, create server deamons and a lot more. This is a rather big project, which means that I have to get used to the language and get myself an optimal setup before actually starting to avoid overhead and unneeded hassl...

Dynamically access an object property array element in PHP

I have an object, that I would like to interact with dynamically. I would like to rename the game1_team1 in: $default_value = $individual_match->field_match_game1_team1[0]['value']; to be game1_team2, game2_team1, game2_team2, game3_team1, etc. Based on the loop they are in. I have tried: $dynamic = 'field_match_game'.$i.'_team'.$j;...

Best technique to print text to console

Hello, I am writing a command line tool that performs a number of tests to our servers and reports an output to screen. I am currently using log4j to print to screen and to a log file. However, I was wondering if there was a better technique to manage all the printing from one class instead of having the "print" commands scattered all...

php Extends three class without interface

I have three class , called A,B,C and another class called X. In this X class I want to access a few function from A, B and C. I know if I want to access the function in one class, I can use: class X extends A { ... } Now I can access all A public functions, but now I want to access the B and C class functions as well. How do I acc...

Why is it possible to override instance variables in PHP but not in Java?

Consider the code below: <?php class Base { protected $name = "Base"; public function getName() { return $this->name; } } class Foo extends Base { protected $name = "Foo"; } $f = new Foo(); echo $f->getName(); // output: Foo $b = new Base(); echo $b->getName(); // output: Base Since in ...

Methods in Object-Oriented Design

Q1. In my university studies of object-oriented modelling and design they recommend thinking about what an object can do for its method, and what its responsibilities are for its attributes. All attempts at clarification have resulted in further confusion. This tends to generate a class diagram with actors who have all the actions, and ...

Object Oriented c++ Question

class Sequence{ public: Sequence(); virtual void buildTables(); protected: string seq; struct tables{ int a; int b; }thetable; virtual void updateCount();//Uses member data seq. sorry. about the confusion. } void Sequence::buildTabeles(){ for (int i = 0; i < seq.length...

Need Advice - Looking for quality .NET Training (OOP and Silverlight) - Feedback

I am in search of some .NET Training (my company will be paying for this training). I am and prefer learning via books (always have). I would like to know what others have experienced in terms of some quality training - I am looking into two types of training: OOP Design Patterns and Silverlight. I am not seeking these two different t...

Parse Excel Spreadsheet into model in java

Hi all, I have an excel spreadsheet that contains service delivery information for a single client at a time. For example, Max Inc will be provided with health assessments at 3 of their corporate offices. An office may have deliveries of health assessments (service type) on multiple days and performed by different doctors. I've created ...

How can I avoiding casting yet pass in the correct type.

I am using Entity Framework v4. I am trying to implement some logic to Validate my entities before they are saved by overriding the SaveChanges method. I am also POCO for my entities. I get a list of modified and new entities by doing the following. var entities = (ObjectStateManager.GetObjectStateEntries(EntityState.Added | EntityStat...

Javascript Class + Properties not sticking to their values

I'm attempting to make a class in javascript. I create it with the JSON type object thing. Doing this: Foo = { PubId: '', Init:function( oCallback ) { this.sendCommand( 'INIT', {}, oCallback ); }, sendCommand : function( sCommand, aParams, oCallback ) { setTimeout( oCallback, 1000, '{"response":"...

How can I implement the decorator pattern without forcing someone to reimplement everything?

Lifting this example from Wikipedia: // the Window interface interface Window { public void draw(); // draws the Window public String getDescription(); // returns a description of the Window } // implementation of a simple Window without any scrollbars class SimpleWindow implements Window { public void draw() { // d...

Polymorphism in Design Pattern

I have observed that most of the design patterns (I refer mostly from the Gang of Four book) are all based on polymorphism. That leads me to a "enlightened" moment that OOP's polymorphism is the most important feature in the paradigm. Some of the patterns use polymorphism are: strategy, factory, bridge... With that, I don't understand ...

What would make you try (or not try) a new programming language?

I've been designing a pragmatic programming language for 5 or so years, and it probably won't be released for several more years (probably until after my current and next startups succeed or fail). In the mean time, I have two questions that may prove interesting: 1) What attributes of a new programming language could entice you try it...