Quantcast
Channel: OutSystems Community
Viewing all articles
Browse latest Browse all 1476385

[Ideas] Make inheritance possible

$
0
0

Sometimes I do not want a type to identify a specific object. For instance this case:

A real-estate agent has a database with 3 types of buildings. Community, Residential and Office buildings. He builds a web service that returns a list of buildings based om  the address. A residential building has people living in that building. A community building does not have residents but a community  building does have a description property like a church, funeral home or school, etc. All buildings have addresses and based on the type of the building different properties apply.

I know how to work around this in Outsystems but the way a modal is created is simply not right. It is not the truth and therefore just plain wrong in my opinion. Not being able to use inheritance also causes unnecessary data or relations in you database. Some options:

  • Create a different entity for each building resulting in multiple tables
  • You could also use a type for each building but that would result in a building of type community having Null or 0 residents. This is also wrong since residents do not apply to community buildings. Residents property on community buildings should simply do not exist.
  • Create a building and foreign key in the table for each building type to the specific building type properties that apply. Again resulting in more tables, relations.

I know when writing code and using inheritance a Object Relational Mapper “ORM” does the same thing and also creates relations, types and tables as needed. The difference is that my object [Building] in this case is valid and the absolute truth.

Returning a list of buildings without a base class [building] via the web service becomes complicated and hard to understand for the party that will consume the web service. Please change this / make it possible.


Viewing all articles
Browse latest Browse all 1476385

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>