oop

Detail learning of c++ design patterns

Hi Thanks for your valuable time. I want to learn c++ design patterns. I searched on web but I was not getting documents which gives me better details about design patterns. I was getting good details but those were in different URL's, I required all the information in one place only so that it will be better to know what all things a...

learning to use open source software

Hi there Do you know any book, blog, tutorial which explains in a detailed way the use of some open source projects? Maybe you have written such a tutorial, example of open source libraries and your final product is great for a beginner to understand it. I'm in the learning stage of OOP and I really need to learn by examples. I'll like...

Are FP and OO orthogonal?

I have heard this time and again, and I am trying to understand and validate the idea that FP and OO are orthogonal. First of all, what does it mean for 2 concepts to be orthogonal? FP encourages immutability and purity as much as possible, while OO seems built for state and mutation – a slightly organized version of imperative program...

for delegates which one is better and when? how do u think in OOP?

I can declare a delegate as General type, like a public or internal types, also i can create it within a (abstract) class and make it protected, so just some classes can access to that delegate for example: delegate void PublicSample(); interface IMyInterface { event PublicSample mySample; } class Implementor : IMyInterface { ...

javascript - access class members from nested functions

hi, i have this class in javascript var MyGird = Class.extend({ classMemeber1 : "Some Value" ,clickEvent : function(){ this.editor.on({ afteredit: function() { // // HOW TO I ACCESS classMemeber1 from here? ? // // } }) }) how ...

PHP - Getting child class when executing parent function?

Hi, I don't think I am being silly here. class Parent { function load($function) { if (method_exists(__CLASS__, $function)) { // Load Function } } } Class Child extends Parent { function foo() { } } $this->Child->load('foo'); The problem is that __CLASS__ is returning 'Parent'. How do I get it to return Child?...

What Methods Can Be Employed For Using Composition Over Inheritance?

I have a web application (in ASP.NET MVC) with a Quotations controller. This controller can handle multiple Quotation types, MotorQuotation, PropertyQuotation, etc... Currently it is using inheritance i.e. a Quotation model and it's children, to model the domain. The various children classes have differences in the data they store and n...

Loading Settings - Best Practices

I'm at the point in my first real application where I am adding in the user settings. I'm using Java and being very OO (and trying to keep it that way) so here are my ideas: Load everything in the main() and pass it all 'down the line' to the required objects (array) Same as above, but just pass the object that contains the data down t...

$this vs function name

I am getting a hang of OOP and finally started creating them in my scripts. One thing I don't get it is the "$this" after creating an instance of class. For example, this guy coded: class Form { protected $inputs = array(); public function addInput($type, $name) { $this->inputs[] = array("type" => $type, "name" => ...

Need advice on proper class design

Hi all, I am supposed to write a simple Cinema Booking System, which allows a customer to make reservations for movies. The Cinema consists or different theatres, with different amount of seats, price and movie showtimes. The user should be able to input his name and other credentials and then make reservations for 1 or more movies a...

Creating local state for object oriented programming in javascript

I am relatively new to javascript and I have watched two tutorial videos by Douglas Crockford on the subject. He recommends creating object oriented design in javascript in the following way, through the use of nameless functions and closures: function Class() { var privateVar1, privateVar2; function privateMethod1() { } functi...

Ajax heavy application question and OO design questions

I have a enterprise webapp that is extremely ajax heavy, all data goes though some sort of ajax, so is saving, updating deleting etc. Modeled after the MVC paradigm The site is mostly compromised of three parts Interface page An interface page only contains the interface and all the js that goes with it, no data processing of any kind....

issues with 'this' when using within jquery code block

I want to use values of the calling object within the jquery code block, but 'this' is mapped to the jquery object and not eh caller! How to solve this PLEASE? // class myClass = function (){ // member object this._localVars = { _elementClass:'.elem-class', _dots:null, _dotStatus:null }; // membe...

How to create object using Interface in Specific Case

Hello! I have question connected with interfaces and abstract classes. I'll give to you simple example, that could explain what I want to do. So, Lets start. public interface A { string param1 { set; get;} string param1 { set; get;} A CreateObject(string p1,string p2); } public class MyClass1 : A { public string param1 { set; get;...

Why do almost all OO languages compile to bytecode?

Of the object-oriented languages I know, pretty much all but C++ and Objective-C compile to bytecode running on some sort of virtual machine. Why have so many different languages settled on compiling to bytecode, as opposed to machine code? Is it possible in princible to have a high-level memory-managed OOP language that compiled to mach...

General Modular design for a web application

From everyone who've designed a modular enterprise application, I am interested in knowing how do you perceive modularization and what exactly are you parameters? Is layer-based modularization (like controller/web module, service module, domain module) a better approach? Or feature-based modularization better? And Why? In case of fe...

OOP - PHP not working correctly

I am not sure what I am doing wrong, I have try and looked everywhere but nothing I do is working I am using the following code. - I know it is a little long, but if you have time could you please have a look. The issue part is <?php for ($a=0; $a<count($subresults); $a++) { echo '<li id="subcategory"><a id="nav" href="#/'.str_repl...

How to initialize a class with many constructor arguments?

Hello! I have a class that takes many arguments to create. It’s a sort of an audio processor that needs a sample rate, sample resolution, number of channels etc. Most of the parameters have sane defaults. And most of them should be only settable in the initializer (constructor), because it makes no sense to change them afterwards. I do n...

Storing or computing totals for complex models

All, I'm developing an application using Zend Framework to manage tenders for construction work. The tender will be a rather complex set of models with an architecture resembling the code snippet below. My question is... should I store the total value of the tender as part of the tender model, or should I compute it each time it is re...

What are uses for multiply bounded type parameters in Java?

In Java generics you can use "&" to specify multiple interfaces as type bounds for a type parameter. This allows us for example to manipulate objects of different types with common interfaces to be manipulated uniformly even if there is not an parent interface for those common ones. My question is, how can this be used? For What purposes...