[Cuis-dev] Subclassing SmallInteger for representing numerical things?

Casey Ransberger bahweep at icloud.com
Fri May 3 11:22:09 PDT 2019


We get taught to subclass something when we need an object with custom behavior, but that isn’t always the best plan. With simple (VM-primitive) things, you’re better off creating a class and then sticking the smallint in an instance variable. 

Basically: there’s usually not a need to subclass classes that represent primitive values. Just use instances of them in your own class based on Object or anything you want to inherit from. 

> On Apr 26, 2019, at 11:55 PM, Alex Schenkman via Cuis-dev <cuis-dev at lists.cuis.st> wrote:
> 
I cut out some graphics from the below for bandwidth purposes. (—Casey)
> 
> Subclassing SmallInteger for representing numerical things?
> 
> Subclassing SmallInteger for representing numerical things?
> I want to represent a telefon country code (like 46 for Sweden or 54 for Argentina).
> STACKOVERFLOW.COM
> 
> 
> Thank you!
> 
> 
> Alex Schenkman
> Tel.: +46 (0)70-295 1723
> 
> -- 
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190503/243bff3d/attachment-0001.html>


More information about the Cuis-dev mailing list