{"comment":{"created_at":"2011-10-15T01:05:02Z","body":"Categories seem like a feasible solution, with only one problem. With categories, any instance of ANImageBitmapRep will respond to all of the selectors for all categories that were compiled with the app. Despite the fact that you may only import ANImageBitmapRep+Crop.h, all of the scaling and rotating method implementations will still be in the instance's runtime implementation table. This is why using different classes for different functionality is a better method for doing the same thing.\r\n\r\nTo fix the issue that you bring up (of cascading subclasses), I have instead taken to a composition architecture. There is a base class, namely BitmapContextRep, which serves basic CGContextRef functions, etc. Then, there are a set of \"manipulator\" classes, which encapsulate BitmapContextReps, but are not subclasses of BitmapContextRep, although they will respond and forward any methods that the underlying BitmapContextRep may implement. Finally, the ANImageBitmapRep class creates an instance of each of these manipulators, and dispatches invocations to those manipulators. This architecture is essentially a roundabout way of doing multiple inheritance in a language that does not support it.\r\n\r\nYou can look at my latest commits to see what I am talking about. This composition architecture allows you to work with any of the manipulators, without creating an instance that has all of the available implementations in its implementation table.  I prefer this to categories, but of course everyone is entitled to their own opinion.","updated_at":"2011-10-15T01:05:02Z","url":"https://api.github.com/repos/unixpickle/ANImageBitmapRep/issues/comments/2412880","id":2412880,"user":{"avatar_url":"https://secure.gravatar.com/avatar/73160611f90c8c1e1cdc79f43702bda1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"73160611f90c8c1e1cdc79f43702bda1","url":"https://api.github.com/users/unixpickle","id":406021,"login":"unixpickle"}},"action":"created","issue":{"number":6,"created_at":"2011-10-11T01:09:06Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"Why you build this library as a cascade of inheritited classes is beyond me? Maybe I'm missing something, but why not just build a single class with extensions/catagories for differnet opperations?","comments":3,"title":"Something against Catagories?","updated_at":"2011-10-15T01:05:02Z","url":"https://api.github.com/repos/unixpickle/ANImageBitmapRep/issues/6","id":1869832,"assignee":null,"milestone":null,"closed_at":"2011-10-11T01:25:11Z","user":{"avatar_url":"https://secure.gravatar.com/avatar/c108a27181fb47626092b9dc9fd2a0b8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c108a27181fb47626092b9dc9fd2a0b8","url":"https://api.github.com/users/bguest","id":287379,"login":"bguest"},"html_url":"https://github.com/unixpickle/ANImageBitmapRep/issues/6","labels":[],"state":"closed"},"legacy":{"issue_id":1869832,"comment_id":2412880}}