Remember the game Civilization, where there was a large scrollable map with different behavior of some tiles. Or in Google Maps there is also a map where tiles are loaded with Ajax.
Where can I find more information on tiles classes (in C++)? How does a class hierarchy look like to implement a scrollable canvas with tiles?
...
Hello!
I'm trying to overrun quite big (for me) problem that I came across while writing my application.
Look at this, please (I will try to shorten the code for simplicity):
I have root interface called IRepository<T>.
Next, IBookRepository : IRepository<Book>
Next, concrete class that implements it: BookRepository : IBookRepository
...
This is a general best practice question about creating parent / child relationships with objects.
Let's say I have Wheel and Car objects and I want to Add a Wheel object to car object
public class Car{
private List<Wheel> wheels = new List<Wheel>();
void AddWheel ( Wheel WheelToAdd)
{
wheels.Add(WheelToA...
I would like to override a method in an object that's handed to me by a factory that I have little control over. My specific problem is that I want to override the getInputStream and getOutputStream of a Socket object to perform wire logging; however the generic problem is as follows:
public class Foo {
public Bar doBar() {
...
I have an interface "IPartyCountService" that counts number of customers and number of suppliers.
The implementation class "PartyCountService" makes use of type checking to check whether the party is a Customer or a Supplier.
My question is: does the implementation class PartyCountService's use of type checking give out code smell? Ple...
Hellow, I've been working on OOP methods lately, and here is something I've always been wondering.
Let say we have the following situation. We have a collection of pets [dog, cat, mouse].
Each pet has the same behaviour: running, eating, sleeping. Furthermore, they all have a different visual representation.
Instead of making 3 seperat...
I have a parent class and a children class. In a parent class I define a function f() and want to print in it name of children class that extended parent class and name of children method that called this function. I do it like that.
abstract class ParentClass {
public function f() {
$backtrace = debug_backtrace();
...
Hi All,
I wanted to ask,
If writing nested(deep) iteration loops (as shown in example) a bad practice (in OOPs)?
For example :
If i want to zip all files that in all Workspaces.
Given example classes are Workspace, Project , File
please ignore avoid syntax errors
for each Workspace workspace in WorkSpaces
{
Pro...
Hi, guys, I am rather new to python and learning it to build a gui application (with wypython). I have a question related with object destruction in python.
e.g. in myFrame I have onNew (create a new document) and onOpen (open a file) method.
briefly, it looks like this.
def onNew
self.data=DataModel()
self.viewwindow=ViewWind...
If I have code like this:
class Person {
$age;
$height;
$more_stuff_about_the_person;
function about() {
return /* Can I get the person's name? */;
}
}
$John = new Person();
$Peter = new Person();
print $John->about(); // Print "John".
print $Peter->about(); // Print "Peter".
Is it possible to print the...
Newbie Python question. I have a class that inherits from several classes, and some of the specialization classes override some methods from the base class. In certain cases, I want to call the unspecialized method. Is this possible? If so, what's the syntax?
class Base(object):
def Foo(self):
print "Base.Foo"
def B...
I'm fairly new to object-oriented programming, and I'm really interested in learning it correctly. My problem is this:
I am trying to create a TabActivity which plots the user's data over time in each tab's content. Then only thing the tabs are going to control is the timespan of the graph. (i.e. one tab for 'past year', one for 'past m...
Suppose I have the following contrived code:
abstract class Root
{
public abstract void PrintHierarchy();
}
class Level1 : Root
{
override public void PrintHierarchy()
{
Console.WriteLine("Level1 is a child of Root");
}
}
class Level2 : Level1
{
override public void PrintHierarchy()
{
Console.WriteLine("Level2 is a...
For example, we have the class Man
If Man.age is protected, then I don't see why chuckNorris (instance of class Man) can change the protected/private attribute age of the object jackBauer (another instance of class Man). He shouldn't be able to do that (IMO).
In my mind, the value of a protected/private attribute is supposed to belong ...
Hi guys,
i' a new iphone developer coming from flash stuff.
let me tell you about my problem:
i'm doing a puzzle game and have a tab bar controller with 4 tabs.
i use 1 tab for sign up and other for login, they works different but uses a lot of the same code (displaying images, playing sounds, settings stuff, audio things, animation...
If a function does all proper checks inside, should I check everything before calling it, or better not? Is security redundancy considered a good practice?
Example (in a sort of C#-like pseudocode with by-reference arguments passing):
doSomething(vector v) {
...;
v.clear;
useCleanVector(v)
}
useCleanVector(vector v) {
if(!v....
Im new in OOP programming and C++ and Im currently into learning design patterns.
Just grab the Head First Design Patterns book to learn from. Its actually great and Im already getting hold into the basic concepts.The first chapter talks about programming to an interface rather an implementation. Unfortunately for me though, the exampl...
I have been playing around with the concept of 'module' that some mvc frameworks implement and it seems like a good solution, and also with TDD, but I think there must be something more, like a design pattern I missed (I only know a few), that will let me build applications that can grow (in code) with no limits.
Any thoughts?
edit : ...
I want to create a "modules" layout in my web application so I can easily add more modules of the same type, for example:
As an example, my WebApp handles subscriptions and email campaigns, and I want to create an interface to allow easily coupling multiple API's, MailChimp, CampaignMonitor, iContact, etc...
so I will create an IMailin...
Hello,
I have an e-shop with multiple product types. And i would have thought of the following structure
Cart_Item
-- Cart_Product
-- Cart_Download
Order_Item extends Cart_Item
-- Order_Product
-- Order_Download
The problem is that i want to have Order_Product extend Order_Item and Cart_Product.
This is because it needs method gener...