All Questions

1136
votes
35answers
393937 views

Passing Data between View Controllers

I'm new to iOS and, Objective-C and the whole MVC paradigm and I'm stuck with the following: I have a view that acts as a data entry form and I want to give the user the option to select multiple pro...
650
votes
30answers
127202 views

What does it mean to "program to an interface"?

I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this? I know what interfaces do, but the fact I am not clear on this makes me think I am missing...
1219
votes
38answers
300764 views

Why use getters and setters/accessors?

What's the advantage of using getters and setters - that only get and set - instead of simply using public fields for those variables? If getters and setters are ever doing more than just the simple ...
1270
votes
33answers
227570 views

Prefer composition over inheritance?

Why prefer composition over inheritance? What trade-offs are there for each approach? When should you choose inheritance over composition?
4151
votes
16answers
554539 views

What are metaclasses in Python?

What are metaclasses and what do we use them for?
485
votes
5answers
142138 views

How should a model be structured in MVC?

I am just getting a grasp on the MVC framework and I often wonder how much code should go in the model. I tend to have a data access class that has methods like this: public function CheckUsername($c...
801
votes
18answers
582877 views

What is the purpose of self?

What is the purpose of the self word in Python? I understand it refers to the specific object created from that class, but I can't see why it explicitly needs to be added to every function as a parame...
1111
votes
32answers
546894 views

Interface vs Abstract Class (general OO)

I have had recently two telephone interviews where I've been asked about the differences between an Interface and an Abstract class. I have explained every aspect of them I could think of, but it seem...
336
votes
20answers
643880 views

What does the 'static' keyword do in a class?

To be specific, I was trying this code: package hello; public class Hello { Clock clock = new Clock(); public static void main(String args[]) { clock.sayTime(); } } But it ga...
793
votes
9answers
171811 views

What is the difference between old style and new style classes in Python?

What is the difference between old style and new style classes in Python? Is there ever a reason to use old-style classes these days?

Previous Next