Skip to main content

Overview of the ObjectScript Tutorial

Welcome to the ObjectScript Tutorial!

ObjectScript is a procedural language with distinctive features, the most notable of which is a powerful and flexible data model and storage engine, called globals. InterSystems IRIS® data platform provides multiple data models and APIsOpens in a new tab for developers. ObjectScript and globals are at the core of it all!

The tutorial has three parts:

  • Part 1 (The Basics) covers standard language elements and introduces the InterSystems ObjectScript extensions for Visual Studio Code.

  • Part 2 (The Good Stuff) covers string and list handling, arrays, and introduces globals.

  • Part 3 (Using Globals) covers globals in depth. It also contains a brief introduction to objects, properties, instance methods, and SQL queries.

Apart from the introductory pages on objects in Part 3, the tutorial covers InterSystems IRIS class definitions only as containers for class methods. The other pages that mention objects are:

  • Part 1, when discussing Try/Catch and Throw. The tutorial covers exception objects along with their important properties and some methods.

  • Part 2, when discussing JSON. The tutorial covers dynamic objects along with some of their methods.

During this tutorial you will write methods (in class definitions) that use many of the features of ObjectScript. You'll use Visual Studio Code (VS Code) as the Integrated Development Environment (IDE) for InterSystems IRIS. The InterSystems ObjectScript and Language Server extensions allow you to connect VS Code to an IRIS server and use it to edit, compile, and debug ObjectScript. This tutorial uses VS Code - ObjectScript to refer to VS Code with the InterSystems ObjectScript extensions installed. Documentation for VS Code - ObjectScript is available hereOpens in a new tab. You can also do the exercises using the older IDE, Studio (Windows only), but the tutorial assumes you're using VS Code - ObjectScript. There will also be examples of using commands and functions shown in the Terminal. You should freely experiment with these examples.

The best way to learn ObjectScript is to do the hands-on exercises that are included throughout this tutorial. In the first few exercises, you'll write code to collect, validate, and store basic data for persons. In later exercises, you'll write code for looking up persons and editing or deleting their data. There are also step-by-step solutions to each exercise, available when you click this picture on an exercise page.

Step by Step Solution

All of the classes used in examples and exercises are available on GitHub in the Samples-ObjectScriptOpens in a new tab repository. You can connect VS Code to the repository, or download the repository and add the classes to your VS Code workspace. Read Downloading Samples for Use with InterSystems IRIS for general information about samples on GitHub.

Note:

Installing InterSystems IRIS using Minimal security settings allows you to use the Terminal, VS Code - ObjectScript, and the Management Portal without authenticating. If you have installed using Normal or Locked Down security settings, these tools will prompt you to authenticate.

FeedbackOpens in a new tab