Basic question about methods


#1

Hi,

I’ve seen multiple instances a class use different method fields to invoke methods. If different instances need to run just one specific method, couldn’t class have just one method field? What is the purpose of using multiple method fields in a class? I have the same kind of question about relationship too. What is the use case for using different relationship by multiple instances? Couldn’t all use use just one relationship field and modify as needed with in the instance?

Thanks,
SN


#2

Hi,

If iI understand well, the purpose of having multiple methods fields even when calling only one methods, is to be more flexible in future. Perhaps someday you will need to cal 2 or more methods, and you won’t have to change the schema.


#3

Lork,

Thanks. That makes sense as far as planning is concerned. I am still not clear on why difference instances would use different method fields. For example, under the class
/ ManageIQ / System / Request
instance InspectMe uses meth5 method field versus Order_Ansible_Playbook instance which uses meth1 method field. Why couldn’t use the same method field (meth1 or meth5). Or is the explanation that, it doesn’t matter, an instance can use whatever method field it want to use and (random, pick any) multiple methods are there to just support future changes.

I understand the case when an instance need to execute multiple methods.

Thanks
SN


#4

In my understanding, it’s only about planning.
You can use any method field you want to execute a method, result will be the same. You use for example meth5 cause you think in future you will use previous methods.
Anyway, you can move a method call for meth1 to meth5 if needed.


#5

Hello Lork,

Thanks,
SN