Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Class vs Routine in ObjectScript. What Do You Use And Why?

Discussion
Evgeny Shvarov · Apr 22, 2018

Class vs Routine in ObjectScript. What Do You Use And Why?

Hi, Community!

Have a question for general discussion. 

In ObjectScript we have cls for classes and mac code, which both compile into int code. 

Is there any reason when you use mac instead of cls  for non-persistent classes?

For me the benefits for cls are:

1. Inheritance and other OOP features

2. Auto-documented code 

For mac one visible benefit is easier call in terminal:

do method^Utils(p1,p2)

vs

do ##class(Package.Utils).method(p1,p2)

What is your choice and why?

#Code Snippet #ObjectScript #Caché

Source URL:https://community.intersystems.com/post/class-vs-routine-objectscript-what-do-you-use-and-why