Hacker News new | ask | show | jobs
by pdonis 4912 days ago
have Company implement the Person typeclass

The obvious solution is to factor out a base class, LegalPerson, with some but not all of the behaviors of the existing Person class. Then derive a separate Company class from LegalPerson. All the stuff we don't want corporations to have, we leave in the existing Person class, so Company doesn't have it.

create a new Suable typeclass

I would view "Suable" as an interface implemented by LegalPerson, and inherited by Person and Company. LegalPerson obviously has to implement lots of interfaces. :-)

1 comments

Ignoring the fact that Person is clearly a subclass of Mammal, I like this.

A couple comments:

- the name LegalEntity feels better to me. (I think it's less likely to be confusing to the lawgrammers who'll be maintaing the code).

- Once we have LegalEntity in place, we should consider discarding the Suable typeclass -- it looks to me like LegalEntity perfectly describes what we're looking for.

There's still a lot of refactoring to be done (I still can't believe the CA Vehicle Code considers a person "a natural person, firm, copartnership, association, limited liability company, or corporation."), but now that the types have been cleared up we have a good foundation to move towards.

Things we should consider going forwards:

- Will the constitution refer to Person, or to LegalEntity? ("new Person() == new Person()" has a nice ring to it if you ask me)

- Why can't all LegalEntities be acted upon in the same way? (Some Legal entities can be put in jail for instance). Is there a type we are missing?

Person is clearly a subclass of Mammal

Well, of course we'll need to use multiple inheritance. :-)

we should consider discarding the Suable typeclass

I would recommend keeping it as an interface definition, to make clear that it is a logically distinct thing; LegalEntity would just implement the interface.

Will the constitution refer to Person, or to LegalEntity?

Depends on the context, I would think. Sounds like we'll need plenty of coders to make this work... :-)

Why can't all LegalEntities be acted upon in the same way?

Obviously we haven't defined all the relevant interfaces and subclasses :-). The one you're looking for here is Jailable, which evidently would be implemented by Person but not Company, and so would not be implemented in the LegalEntity base class.

Obvious next question: what language do we start the implementation in? I vote for Python. Anyone for starting a github project?