oop

What does "monolithic" mean?

I've seen it in the context of classes. I suspect it means that the class could use being broken down into logical subunits, but I can't find a good definition. Could you give some examples? Thanks for the help. Edit: I love the smart replies, but I'm obviously referring to "monolithic" within a software context. I know about monoliths...

Communication in component-based game engine.

For a 2D game I'm making (for Android) I'm using a component-based system where a GameObject holds several GameComponent objects. GameComponents can be things such as input components, rendering components, bullet emitting components, and so on. Currently, GameComponents have a reference to the object that owns them and can modify it, b...

JavaScript: Public methods and prototypes

I'm not entirely sure how to implement OOP concepts in JS. I have a class which is entirely declared in its constructor: function AjaxList(settings) { // all these vars are of dubious necessity... could probably just use `settings` directly var _jq_choice_selector = settings['choice_selector']; var _jq_chosen_list = settin...

lua - capturing variable assignments

Ruby has this very interesting functionality in which when you create a class with 'Class.new' and assign it to a constant (uppercase), the language "magically" sets up the name of the class so it matches the constant. # This is ruby code MyRubyClass = Class.new(SuperClass) puts MyRubyClass.name # "MyRubyClass" It seems ruby "captures...

Benefits of using an abstract classes vs. regular class

I have decided to start doing small coding projects on my own that focus on code quality instead of code quantity and have a question about the use of abstract classes. Now I know the differences between abstract classes and interfaces with the biggest one (I think) being that interface allow you to only define methods that need to be i...

More on the mediator pattern and OO design

So, I've come back to ask, once more, a patterns-related question. This may be too generic to answer, but my problem is this (I am programming and applying concepts that I learn as I go along): I have several structures within structures (note, I'm using the word structure in the general sense, not in the strict C struct sense (whoa, w...

objects or closures - when to use?

I can define an object and assign attributes and methods: class object: def __init__(self,a,b): self.a = a self.b = b def add(self): self.sum = self.a + self.b def subtr(self): self.fin = self.sum - self.b def getpar(self): return self.fin obj = object(2,3) obj.add() obj.subtr() o...

Communication between AS3 and an OOP PHP site

I have an OOP PHP site structured with a MVC pattern. A page on the site has an embedded SWF that needs to pull information from a database. In the past, I would have just had a procedural php file for the swf to load the data from the database from. However, that method doesn't seem like it would fit with a more objected oriented site. ...

Java/Patterns for hiding methods from third party classes

Hi, I have a class A that has a series of handlers e.g. public void handleEv1(),public void handleEv2() etc. When an event occurs, another thread in class B, calls the correspondent handler from class A (class B has a reference to class A kind of observer-observable). In the handling of the event in the corresponding method of class A, ...

How Data Access Layer communicates with Presentation Layer in PHP?

Im new to OOP & PHP. After being fed-up of "Person's Class-Object examples", I want to know exactly how a function would return a set of rows from database to the presentation layer in a way that: Conditions and validations are managed by Business Layer's function (e.g. getEmployees($DepartmentID)). All HTM, CSS and Javascripts are lo...

What's a good average method size?

I say between 1 and 5 lines. Anymore than that you should justify with an email to the rest of your dev team. This aids reuse, forces good naming and couples methods. Any comments? Thanks ...

Java Member Initialization Patterns

I have a class MyClass: public class MyClass { private MyComplexType member1; } I have to do some pretty intense initialization on member1. Enough that it easily warrants its own method, called from the MyClass constructor. My question is, which of the following formats is best for this method? private MyComplexType initMyComplex...

Classes and updating the data

Hi, Warning: This is most likely a very silly question. I have an object that resides in its own header file and is created in main, I would like to update the said object using a function that is declared in a separate file. If I'm not clear please let me know and I will try and explain my self better. //main #include"Object.h" int m...

Table heirarchy in Excel, using Excel as a form with repeating tables

Hi, I am creating a form using Excel. The form will be populated upon creation from outside data, but there will be room for users to enter (but not remove info). I need to have repeating tables. I have created my own version of repeating tables( not using Excel's concept of "table") and I have hyperlinks at the bottom of each table t...

Why do most object oriented languages not support coroutines?

I'm currently preparing for an exam. One of the question I found in an old exam is: "Why do most object oriented languages not support coroutines? (Hint: It's not because they support threads)" The problem is, that I can't find a good answer. Of course you don't need coroutines if you have object orientation, but it would still be very u...

How to add an attribute to mechanize's(ruby) Field class and have it use my extended class.

Basically, when I store a form object I want to some extra analysis on the fields and set a new attribute based on that analysis. Should I just go inside the code and add the attribute manually, or is can I just extend it? How do I get mechanize to use my new class when it gets these fields? Thanks! ...

How to have a class spread across many source files?

I am currently working on a PHP project which includes extensive database usage. The basics are: I have a PDOFactory class which follows the Factory pattern and an abstract SQL class with static methods (just a container for those methods) which in turn talks to PDOFactory As I said, the project involves extensive database usage, so the...

C++: Two classes needing each other

I'm making a game and I have a class called Man and a class called Block in their code they both need each other, but they're in seperate files. Is there a way to "predefine" a class? Like Objective-C's @class macro? ...

What is the best practice way to build my model?Update

Hello, I'm currently rebuilding an admin application and looking for your recommendations for best-practice! Excuse me if I don't have the right terminology, but how should I go about the following? Take the example of "users" - typically we can create a class with properties like 'name', 'username', 'password', etc. and make some meth...

Data Mapper API - unsure about organisation

Let's say we have "User" and a "Hotel" model classes. I'd use a User_Mapper and Hotel_Mapper to load/save/delete etc. I want to then have the user be able to mark their "favourite" hotels. In the database I have my user_favourite_hotels table which is a simple link table along with say a field for subscribing to hotel updates. When list...