Pig disgusting OOP in a pig disgusting language used by a pig disgusting imageboarder or outsider that can't understand the purpose of private, public and protected, and has never tried a real OOP language like Smalltalk or Io.
Name:
Anonymous2011-05-19 20:44
Your class should only be accessed by interfaces and only the members exposed said interfaces should be public.
Yes, public, private and protected all have their own uses. However, the question remains what one should use as a default for good practice when any in particular would work just as well.
Also, I've used Ruby. It's pure OOP and doesn't have the shit syntax of smalltalk.
No... No that would not be correct. The syntax (and speed) is much closer to python than perl. Also, applying "with classes" to ruby is a serious understatement, because everything is an object including lambdas.
The idea is to retain control over your classes. Consider the default to be private and you need a reason to go to higher availability. While using interfaces prevents users from using your implementation, it doesn't help if someone inherits your class.
Name:
Anonymous2011-05-19 21:23
I prefer to use Common Lisp's packages instead of classes. They much more simplier and more robust. Alas, CL's standard library does make-hash-table and make-array, instead of more elegant hash:new and array:new.
>>12 The idea is to retain control over your classes.
Just name your classes as CShitV1_0, CShitV1_1, CShitV1_2, etc.. Every new release can change everything without problem.
Name:
Anonymous2011-05-19 22:17
>>16
Microsoft does this with DirectX and other system dlls. Works like a charm.
>>16-17
Don't forget the NULL, NULL, NULL, NULL, NULL, NULL, on method calls.
Name:
Anonymous2011-05-19 22:46
>>18 Don't forget the NULL, NULL, NULL, NULL, NULL, NULL, on method calls
C/C++ cannot into &key and &rest, so you must endure.
Name:
sb2011-05-19 22:51
Always use private and use getters and setters unless it is a private class. Trust me, things will change in the future and you will want to be able to change your implementation without having to change all the code that uses your class.
Name:
Anonymous2011-05-19 22:53
>>20
Functions delay binding; data structures induce binding. Moral: Structure data late in the programming process. -- Alan Perlis
I'll sometimes keep things public for the sake of convenience with debug statements. A better solution would be to just write a super debug printing function for each class. I try to keep as much as possible private though, just so I have less to think about.