What is the equivalent of object oriented constructs in python?
How does python handle object oriented constructs such as abstract, virtual, pure virtual etc Examples and links would really be good. ...
How does python handle object oriented constructs such as abstract, virtual, pure virtual etc Examples and links would really be good. ...
It's been years since I thought of this, but I am training some real juniors soon and need to explain what an object is to someone who doesn't know what it is. Based on what you use in the real world, what are the key points of objects that I should focus on explaining. For example: Access Levels Inheritance Encapsulation Polymor...
First off, my focus is web development (ASP.net webforms up to now), using C#. But, I am interested in learning design principles that will carry into any technology or language. I have been ready for a long time to step up, and learn how to design software the right way. Up to this point, the software I write has been designing the dat...
Allen Holub wrote the following, You can't have a program without some coupling. Nonetheless, you can minimize coupling considerably by slavishly following OO (object-oriented) precepts (the most important is that the implementation of an object should be completely hidden from the objects that use it). For example, an object's insta...
Is this old way to explain for PHP oop, if he use var thing? for example, <?php class person { var name; } ?> ...
Dear gurus, I was recently thinking how I'm not always using the beautiful concepts of OO when writing Pythonic programs. In particular, I thought I'd be interested in seeing a language where I could write the typical web script as # Fictional language # This script's combined effect is to transform (Template, URI, Database) -> HTTP...
How do I model any additional properties from One-Many relationships in the database back into classes? For example I have 3 tables Model, Manager and Model_Manager. The Model_Manager table has ModelId, ManagerId and two extra properties - Percentage and Owner. At first I created two classes Manager and Model and the Model class contai...
I just found myself copying and pasting the same code twice. Right now I have one function that I want to share between two source files. It will pass the same variables from both source files. If I don't want to "repeat myself" would this be the best course of action? If both files have other functions that are separate should these...
After enabling strict warnings in PHP 5.2, I saw a load of strict standards warnings from a project that was originally written without strict warnings: Strict Standards: Static function Program::getSelectSQL() should not be abstract in Program.class.inc The function in question belongs to an abstract parent class Program and is de...
What does $this-> mean in CakePHP? Please answer this in two parts... What does $this refer to? What does -> refer to? Can someone explain each part explicitly in terms of the statement $this->Post->find('all'); in the Post controller. Why do you need the ->Post part if it is in the Posts controller? ...
Hi, I'm doing some validation now in PHP, and I'm running allot of conditional statements, for example: if ($this->email->isValid($email)) return false; if ($this->username->isValid($username)) return false; ect.. Is there a nice way to do this? Or do I just run ten If statements like the ones above? I can't use switch obviously,...
What is right way when using Zend_Form to create concrete application forms 1) Using "extends" and derived class class MyForm extends Zend_Form { public function __construct() { $el = $this->createElement('text', 'el'); $this->addElement($el); // ... } } 2) Or using delegation/proxy pattern class MyForm { private $_form;...
Suppose I am developing an application for a product distributor in C#. The distributor does the following 3 types of transactions: (1) Indent (2) Sell (3) Stock I am designing my classes as follows: public abstract class Transaction { } public class Indent : Transaction { } public class Sell : Transaction { } public class S...
I'm trying to convince a colleague that a function should take an interface as a parameter, and not the object itself. I think small objects can be fine to pass across, but for large ones I would give them an interface and just pass the i/f over, not the whole thing. Note that there will only ever be one of these large classes - the i/f...
I am pretty new to OOP with PHP. OK first of all this produces an error: $mail->addBody(new MailWishListInquiry()->getBody(348)); but this doesn't: $wishListInquiry = new MailWishListInquiry(); $mail->addBody($wishListInquiry->getBody(348)); I do not understand why? Also the method getBody() is not returning anything..but no erro...
I love having a book in front of me, but right now I can't afford to buy anymore books and all my libraries suck, so I'm wondering what free sites/resources exist where I can learn about best practices for designing classes? ...
What is it called when an object has an object of the same type inside of itself? Example: public class Foo{ public Foo myFoo; } ...
I'm attempting to model a grocery store. In the store, there are several "aisles". Each "aisle" has a group of "categories" of "items" it stores. Each "category" can only belong to one "aisle". Each "item" can only have one "category". The data model seems straight forward to me: An "aisle" table with an ID and DESCRIPTION A...
Does it matter if I call the method of the super class first thing or at the end? For example -(void)didReceiveMemoryWarning { /* do a bunch of stuff */ [super didReceiveMemoryWarning]; } versus -(void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; /* do a bunch of stuff */ } same question for other method...
I need to find a way to show the value of a custom attribute in place of the "Product Name" shown in the image below. I'm working with /app/design/frontend/default/defaultx/template/catalog/product/view/type/grouped.php The code below doesn't work(the custom attribute is yearmade): <?php if (count($_associatedProducts)): ?> <?p...