Inheritance for Entities/Core Services

Hi everyone,

I am brand new to Outsystems and watching the tutorials / learning path while playing around with an app in service studio under a free account.

As part of my long term goal I know I will need tables for Customers, Vendors, and possibly other "Company types..."  Is there any availability of inheritance so that I can specialize each one to their names but at the same time use the same building blocks that are consistent across anything of a Company type?  


For example they all need related contacts which I would think could be one central entity.  They also all need an address, phone number, etc.

Just wondering what is best practice here.  Is it to create separate Entities for Customer, Vendor, Service Agent, etc. and repeat some of that logic and they all relate to a "Contacts" Entity or is it best to have a generic Company and specializations (again I thinking whatever the outsystems version of inheritance is)?


Thanks in advance!

Hello @Ivan Weiss 

In OutSystems we create modules according to our Architecture Patterns, these are the best practices we follow,

so that we don't have any issues. and our application build will go smooth,

we define database core entities in  Core layer which is a best practice to follow,

we can define the there and when we select their property as public, the we can take a dependency of them into our module.

You can follow this course for all the best practices

https://www.outsystems.com/training/paths/8/architecting-sustainable-applications/

also this discussion will also help - This

Thanks 

Tousif

Hi Ivan,

you have multiple options. You can use a single table with all attributes across all your different company types and then use different data structures to "drill down" to certain types.

You can also create different tables for each type eg

Company entity with all common attributes

Customer entity with specific customer attributes. Since customer is an extension of the Company table you set its Id attribute to Company Identifier.

What to take can depend on the amount of different attributes and your personal preference. One other thing to consider: If you are using Aggregates to query data it is better to create a table by type approach to minimize data retrieval. Advanced SQL gives you an alternative but maybe that is a little to tough to start with.

Another thing to consider is the licensing model. OutSystems switched backed to an AO based model for new contracts. An entity costs you 1 application object each. Having a inheritance by table model for Customer and Vendor would take 3 AOs. One for the common Company entity, one for customer and one for vendor.

Hope that helps,

Stefan

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.