|
Re: Adding methods to Integers...: msg#00092lang.smalltalk.squeak.beginners
It is fine to add methods to kernel classes like LargePositiveInteger. Just make sure you use new names, because you don't want to override an inherited method by accident. There are several problems with adding methods to existing classes. One is when you override a method by accident. To prevent this, pick unique names for methods. Another is when someone changes the class, breaking your code. you can run into this problem when you subclass a kernel class, too. It is not likely to happen in the near future, but if you wait long enough, the class is likely to change. Finally, someone else might want to change the same class, and your changes will conflict. If you are writing code that you expect will last a long time and that will be reused by many people, avoid changing kernel classes as much as possible. if you are writing a quick hack to see if you can do something, do whatever seems easiest. One of the big advantages of Smalltalk is that you can change anything. Changing system classes has the potential to increase the cost of maintenance, but it definitely can reduce the cost of making your system in the first place. -Ralph Johnson
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Squeak Firefox plugin on Linux, Andrew Dabrowski |
|---|---|
| Next by Date: | Re: Re: Squeak Firefox plugin on Linux, Bert Freudenberg |
| Previous by Thread: | Adding methods to Integers..., Patrick Stein |
| Next by Thread: | Re: Adding methods to Integers..., Klaus D. Witzel |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |