oop

What is a good Objective-C App to get started on?

I am starting Objective-C with intention to get into extensive iPhone Development. Where are some good places to start? I have purchased 2 books: Programming in Objective-C by Stephen Kochan and Beginning iPhone Development by Dave Mark and Jeff LaMarche The tutorials are good, I would just like to get into my own t...

SQL role security + custom ASP.Net base page

I'm workng on a new, green-field ASP.Net application. We're implementing a base page which all pages will be, er, based on. The application will be running under Integrate Windows Auth, so I'll have the user's account details. With these, I'll be going to several databases (in which the user will exist) to find out what roles they are as...

How to allow derived class to call methods on other derived class? OO-design

Say I have something like -- this is just an example mind you. class Car { void accelerate(); void stop(); } class Person { void drive(Car car); } class Toyota : public Car { void accelerateUncontrollably(); } class ToyotaDriver : public Person { void drive(Car car) { // How to accelerateUncontrollably without...

Is learning the Caché database hard coming from relational databases and object oriented programming language like Delphi ?

I am currently running the local version of Caché on my system in order to determine if I can (and will) take on a new possible project. The current project uses Delphi 7 as a front end calling a Caché dll where the business logic is stored in the database. I have a background of Sqlserver and Firebird (and before Access and Paradox) a...

Making Child classes as Non Serializable in java

I have a class which implements Serializable. Now I extends this class and I want this extended class to be non Serializable. So how to do it? For example. I have class A implements Serializable. and i have class B extends A. But I want class B to be Non Serializable. ...

Describing class relationships in ruby

I've never done any straight ruby coding - only worked with the Rails framework. I am not sure how to describe the relationships between Classes, other than inheritance relationships. For example, a School object may have many Student objects. I would like to be able to make calls like "myschool.student[2].first_name" and "mystudent.sc...

How to init class with unknown number of String params?

I'm working on API which should provide simple access to number of remote web-service based resources. Some of these remote resources requires special parameters to be passed before interaction. For example, one of them requires pair of developer's keys to be passed, another requires pair of keys and unique identifier. Third one does...

Inheriting properties from an abstract class, and sorting a collection on an abstact property

I am creating an invoice management application using Grails, and am experiencing problems with inheritance. If is my intention that each invoice should contain a collection of lines/items, and that when the invoice is formatted for printing, the items are sorted by date, separated into lists by category, then have the price of each lin...

Method overloads and code duplication promotion

Hi, Overloaded methods tend to encourage a habit of duplicating the code between all methods of the method group. For example, I may concat a string, write it to file, etc in one method but then do the same in another method but with the addition of an additional parameter (Creating the overload). The methods themselves could go in a b...

In C++, is it possible to reconcile stack-based memory management and polymorphism?

I love declaring variables on the stack, especially when using the standard container. Each time you avoir a new, you avoid a potential memory leak. I also like using polymorphism, ie class hierarchies with virtual functions. However, it seems these features are a bit incompatible: you can't do: std::vector<BaseType> vec; vec.push_back...

C# - Global Program Object

Scenario I have a non-static class that wraps around Log4Net. This is really handy as it links up to a further application I have that displays logs of different processes that occur in a variety of software that I write (to allow me to see where errors occur, batch processes fail etc.) Problem This is all well and good, but if I want...

Game design in an OO manner

I'm designing a simple game, which uses Java 2D and Newtonian physics. Currently my main "game loop" looks something like: do { for (GameEntity entity : entities) { entity.update(gameContext); } for (Drawable drawable : drawables) { drawable.draw(graphics2d); } } while (gameRunning); When an entity is instructed to u...

Zend Framework: How to construct a simple "Data Mapper" model?

I'm building an application in the Zend Framework, but I'd like to implement a "Data Mapper" style ORM layer, constructing Model classes that only include the specific pieces of data they need to represent the domain concept (regardless of which tables those fields happen to belong to). Since my DB structure is highly normalized, the ben...

Python design question

I'm a C programmer and I'm getting quite good with Python. But I still have some problems getting my mind around the OO awesomeness of Python. Here is my current design problem: The end "product" is a JSON data structure created in Python (and passed to Javascript code) containing different types of data like: { type:url, {urlpayload...

How can I "think" in OOP ?

I am learning php5 and have covered all the basics concepts. Now to do the actual work. I realize the biggest challenge for me is dividing and organizing which classes should do what; I am stuck. With proecedural, I would be half done by now... What are some rules of deciding how many objects you should be using? Do you divide to sma...

How can I concatenate a constant and a variable and store it in a class constant with PHP?

class My_class { const STATUS_ERROR = 0; const STATUS_OK = 1; const DB_TABLE = TABLE_PREFIX . 'class_table'; } The two status consts work fine and can be accessed within class methods as self::STATUS_ERROR and self::STATUS_OK just fine. The issue is one of how to stop the following error being thrown when I try to define th...

[PHP] Unset Class

Hello Guys, i have a complete Form creation System. There are many different Question Types and I have to check if the answer which the person had made is correct. All types of Questions has its own class will is always called ItemClass and this Class is in its own File. Everytime a Question is asked I include the File and the there is...

When do you define a class?

Say you want to write a Tetris clone, and you just started planning. How do you decide what should be a class? Do you make individual blocks a class or just the different block-types? I'm asking this because I often find myself writing either too many classes, or writing too few classes. ...

design a circle in the 3-D space

How to design a circle in the 3-D space? For a circle in the 2-D space, two members are enough. 1 center; 2 radius; but in 3D, how can I define the direction and the position of the circle? ...

Is there anything composition cannot accomplish that inheritance can?

Composition and inheritance. I am aware that they are both tools to be chosen when appropriate, and context is very important in choosing between composition and inheritance. However, the discussion about the appropriate context for each is usually a little fuzzy; this has me beginning to consider just how distinctly inheritance and po...