oop

PHP OO vs Procedure with AJAX

I currently have a AJAX heavy(almost everything) intranet webapp for a business. It is highly modularized(components and modules ala Joomla), with plenty of folders and files. ~ 80-100 different viewing pages (each very unique in it's own sense) on last count and will likely to increase in the near future. I based around the design arou...

Codeigniter Best Practices for Model functions

Say my application has a "Posts" model, and one of the function is add_post(), it might be something like: function add_post($data) { $this->db->insert('posts',$data); } Where $data is an array: $data = array ('datetime'=>'2010-10-10 01:11:11', 'title'=>'test','body'=>'testing'); Is this best practice? It means if you use tha...

Class member variables, methods and their state

How should class member variables be used in combination with class methods? Let's say I have a class 'C' with a member variable 'someData'. I call C.getData(), which does not return a value but instead puts data in C.someData. The class that instantiated 'C' first calls C.getData and then uses the data by accessing the member variab...

C# COM Messaging system design

Hi all, I can use some help for a designing my COMport connection classes. I have a device with a microcontroller (which I programmed) connected to my comport. Whenever I send a message to it, it should send an acknowledge. So whenever I send something over the comport, it should wait for an acknowledge before continuing. Ofcourse, I ...

An issue on object orientation in php

Hello people, I have come up to issues while I'm trying to write some classes, here is an example: I have this class called TwitterGrub and I cant call it like that: $c = new TwitterGrub(); $c->twitterDisplay(); here is the class itself: <?php class TwitterGrub{ function twitterCapture($user = 'username',$password = 'pass')...

What is the fragile base class problem?

What is the fragile base class problem in java? ...

Page inheritance in mixed asp.net Forms and MVC application

I'm working on a web application. One of my co-workers has written some asp.net forms pages. The page classes all inherit from BasePageClass, which of course inherits from the Page class. I wish to add some MVC controllers that I've been told need to use the same logic implemented in the BasePageClass. Ordinarily, I would want to inh...

How to indicate which implementation of an interface to return, based on some flag/argument?

In a distributed application that has multiple databases that support it, we're looking for better ways to handle the creation of the database connections. For example, suppose your system has three database behind it: Business Data (orders, products, categories, etc) Metadata (data about the structure of the business data) User Data (...

Looking for early paper about compiling object-oriented code

I remember reading a paper a long time ago that talked about object-oriented programming. I believe that this was from the early 1980s or perhaps even before then. This was at the time when object-oriented programming was still done through pre-processors, and one thing that stuck with me is this: it argued that you could write code in ...

OOP design for DMS that allows searching and grouping

I'd like to make a searchable Document Management System and allow a user of this application to group documents together. On one hand, there would be a functionality that registers/fingerprints in a global linear fashion and, on the other, there would be a functionality that associates documents into distinct groups. How could I compr...

What should I put into classes and what stuff I shouldnt?

I am learning about classes right now in PHP and their examples are like.. class table { //makes a table private $tag ; function Begin($border=0, $align="center", $width='100%', $cellpadding=2, $cellspacing=2, $class='', $id='', $bgcolor='', $style='') { $this->tag = '<table ' ; if ($align) ...

Why is execution-time method resolution faster than compile-time resolution?

At school, we about virtual functions in C++, and how they are resolved (or found, or matched, I don't know what the terminology is -- we're not studying in English) at execution time instead of compile time. The teacher also told us that compile-time resolution is much faster than execution-time (and it would make sense for it to be so)...

Refactoring Singleton Overuse

Today I had an epiphany, and it was that I was doing everything wrong. Some history: I inherited a C# application, which was really just a collection of static methods, a completely procedural mess of C# code. I refactored this the best I knew at the time, bringing in lots of post-college OOP knowledge. To make a long story short, many o...

I'm still learning OOP. Any tips on staying unbiased and pragmatic?

I keep reading about defficiencies and issues with languages. Specifically, I'm learning PHP and Javascript, but I see it everywhere. This question arose while reading Javascript: The Good Parts and PHP Objects, Patterns and Practice. While understanding and avoiding easy pitfalls, is there a way I can learn the fundamentals of OOP and d...

Object Oriented Programming in AS3

I'm building a game in as3 that has balls moving and bouncing off the walls. When the user clicks an explosion appears and any ball that hits that explosion explodes too. Any ball that then hits that explosion explodes and so on. My question is what would be the best class structure for the balls. I have a level system to control levels...

IRequest / IResponse Pattern

I am trying to create an Interface-based Request/Response pattern for Web API requests to allow for asynchronous consumer/producer processing, but not sure how I would know what the underlying IResponse class is. public void Run() { List<IRequest> requests = new List<IRequest>(); List<IResponse> responses = new List<IResponse(); ...

How do I define my own operators in the Io programming language?

I'm trying to define my own operator in Io, and I'm having a hard time. I have an object: MyObject := Object clone do( lst := list() !! := method(n, lst at(n)) ) But when I call it, like this: x := MyObject clone do(lst appendSeq(list(1, 2, 3))) x !! 2 But I get an exception that argument 0 to at must not be nil. How can I fix?...

Questions about "casting operation" in OOP

When programming, we usually use some type-casting operations. When the casting happens on the objects "on the same level", it feels ok. But when it happens on the ojects "on the different levels"(mainly between father and son), it feels weird. Considering this: Class Son extends Father WhenSon s = (Son)father;, it's absolutely unre...

How do I know if an input sting is a method name of a specific class?

Inside an object, I get a string and I have to know if there is a method with the same name in the current object I am in. How do I do that? ...

How should I implement items that are normalized in the Database, in Object Oriented Design?

How should I implement items that are normalized in the Database, in Object Oriented classes? In the database I have a big table of items and a smaller of groups. Each item belong to one group. This is how my database design look like: +----------------------------------------+ | Inventory | +----+------+-...