oop

Implementing my own interface in vba always raise this error !!!

how to Implements my class 'ClsInterface' which have this code Public Function add(x As Integer, y As Integer) As Integer End Function in my class 'Class2' which have this code Implements ClsInterface Public Function add(x As Integer, y As Integer) As Integer add = x + y End Function my test code is Public Sub test() Dim obj As N...

C#, reading in Fixed Width records, varying record types in one file

To start I would like to clarify that I'm not extremely well versed in C#. In that, a project I'm doing working in C# using .Net 3.5 has me building a class to read from and export files that contain multiple fixed width formats based on the record type. There are currently 5 types of records indicated by the first character position i...

Application Architecture Question

I'm new to designing OO systems. I have a simple Flash Cards app where I'm having trouble figuring out the proper way to architect the system. The application has a simple GUI with a question, answer, and couple buttons. The questions and answers dataset are stored in a Derby embedded database. Quick Setup: Database Class - Handles the ...

In PHP, whats the difference between :: and -> ?

Noob to PHP here, I've come across 2 distinct function calls which I'd like to clarify... Whats the difference between $response->setParameter('foo', 'bar'); and sfConfig::set('foo', 'bar'); I'm assuming -> is used for functions for variables, and :: is used for functions for classes. Correct? Different question, is the => assig...

Should passing parameter in method be avoided and used as much as possible in OOP?

Here is a scenario class page { public $name; public $title; public function showhead() { return "<head><title>".$this->title."</title></head>"; } } $mypage = new page; $mypage->title = "My Page title"; $mypage->showhead(); and another scenario class page { public $name; public function show...

Active Record Design Pattern???

Hi all, I've been looking into various ORM frameworks lately (mostly .net) and see that the Active Record design pattern is commonly used to persist data. I just wondered what everyone's take on the active record pattern is? Personally I think it puts too much responsibility on the data object, be it just a data container or an entity...

I need help designing my oo database to handle multiple kind-of relations

i'm currently creating a database program in java and i am a bit stuck with the design. it's pretty straight-forward until i hit the part where there are more than 40 different kinds of activities that can range from from book-selling to tutorials to radio/tv show appearances. each activity type has a different set of properties, such as...

OOPs paradigm in Python

Here is something I've been having a doubt about. Consider the following snippet. class A(object): def check(self): super(A, self).check() print "inside a" class B(object): def check(self): print "inside b" class C(A, B): pass c = C() c.setup() Now this gives the output, inside b inside a Pass...

Object Oriented Design Problem, Liskov Substitution Principle

Hi everybody, I'm making the design of a OO framework and I'm facing the following problem. Let's say that in the framework I have a Shape interface and the users are free to implement and extends (adding new functions) the Shape interface to create their own figures, e.g. Square and Circle. To make these new objects available the user...

How to avoid opening multiple connections to the DB with OOP PHP.

I've been a procedural programmer for over 4 yrs and it's time to start looking into OOP. With that said, let's say I needed to call two methods in my class. Each method requires a connection to the DB so that's two trips to the DB, which also opens multiple connections. Can this be avoided by having some sort of code in the application ...

C++ FSM design and ownership

Hi, I would like to implement a FSM/"pushdown automaton" parser for this syntax: http://stackoverflow.com/questions/3025293/c-general-parser-with-scopes-and-conditionals which has already been "lexed" into http://stackoverflow.com/questions/3085070/finite-state-machine-parser I have the following: class State { public: virtual Sta...

JavaScript: What's wrong with this constructor?

I'm not entirely sure how to implement objects in JS. Here is a constructor: function FooList(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { alert("constructing"); this._arg1 = arg1; this._arg2 = arg2; this.refresh(); } I am trying to call it here: FOO_LIST = new FooList( arg1, arg2, arg3, arg4, arg...

C# Progress Bar within a class?

Simply put, what is a good way to send the progress of some process back to a form from within a class outside the scope of the form? EG: I have a Input object, a filepath is sent into the constructor of this object and it parses the file. I want to show the progress of reading in the lines of this file back to the user who is in a for...

Question about use of Controllers

I was given a Use Case for a Quizz Application. The Use Case is only for creating new Quizzes. I am having trouble deciding which design is better: a) b) Although this might look like a Domain Model, it is in fact a Class Diagram (I was lazy to put the methods/attribtues in the diagrams :( ). The idea behind all this is that I ha...

very simple OOP question

Hi folks, Hopefully a quick and easy clarification only...With this code found in an action in a controller: ... $SaveAccount = new SaveAccount(); $SaveAccount->saveAccount($username, $password, $email); ... Does the second line mean "run the method "saveAccount()" on the new object? Is that what the -> means? Thanks! ...

If you are using an interface-based design approach, how do you name the more behavioural interfaces?

I'm developing a library containing multiple controls (or components). I'm using an interface based approach to type design, but eventually it led me to a question that bothers me for a long time. If you use an interface-based design approach, how do yo name the behaviour interfaces? For example, let's assume you have some getter setter ...

How to create a correct hierarchy of objects in C++

Hi, I'm building an hierarchy of objects that wrap primitive types, e.g integers, booleans, floats etc, as well as container types like vectors, maps and sets. I'm trying to (be able to) build an arbitrary hierarchy of objects, and be able to set/get their values with ease. This hierarchy will be passed to another class (not mentioned ...

What to call OOP's equivalent of "referential transparency"?

My understanding is that the term "referential transparency" can really only be applied to functional code. However, a method call on an object in object-oriented code can have a similar property, which is that the return value of the method, and the state of the object after a method call depends only on the state of the object before ...

Do you recommend procedural methodology software developement for small database application in dot net?

Hello As a new entry to the software development industry I tried to develop my programming skill using different ways. One way I found out is as many suggests by reading code from other authors. When I begin to develop, I want to use objected oriented design paradigm for any application. As a start I begin with small database progra...

javascript anonymous function scope

I have the following anonymous function: (function() { var a = 1; var b = 2; function f1() { } function f2() { } // this => window object! // externalFunction(this); })(); function externalFunction(pointer) { // pointer.f1(); => fail! } I need to call external function from this anonymous function and pass it's pointer to...