Hello! I study in one of the best universities in our country. I study at
NSU (
Novosibirsk State University )!

In October 2015, InterSystems, as part of its academic program, conducted two training courses on InterSystems Caché technologies:
- “Ensemble. Development ",
- “DeepSee. The Basics.
')
Earlier, in the spring of 2015, we took another training course from InterSystems:
- “Developing Applications in an Object-Relational Environment”.
What difficulties have arisen with us, like the beginners of Cache ObjectScript developers, and how we solved them, and I will talk in this article. I hope this material can be useful to other novice COS-developers! I want to show that programming in Caché ObjectScript is not at all scary, and sometimes even convenient! (Be careful, a lot of pictures)
Thanks
On behalf of the students who successfully completed the training courses, I would like to express special thanks to the organizers and teachers of these courses!
We thank
Eugene Shvarov , director of academic programs, for the organization and implementation of training courses by InterSystems!
Separately, we thank
Boris N. Pishchik (senior researcher at the
Institute of Physics and
Technology of the Siberian Branch of the Russian Academy of Sciences , head of
the Computer Systems Department
at FIT NSU ) for organizing and implementing training courses from the NSU, as well as for prompt assistance in solving administrative issues!
We express our gratitude to the teachers of these courses!
We thank
Alexander Pogrebnikov , the teacher of the course “Ensemble. Development ", for the available material presented as well as invaluable assistance in solving the problems encountered during training!
We thank
Dmitrovich Oleg Igorevich (
doublefint ) for the available material, as well as vivid examples of life that allowed us to better understand the meaning, possibilities and potential of the studied technologies!
We thank
Zelenin Anton Yuryevich for the available material, as well as for numerous practical examples of working with the language Caché ObjectScript and related technologies!
Content
Problem 1. InstallationQuestion 1.1. WayQuestion 1.2. System userProblem 2. Getting StartedQuestion 2.1. StartQuestion 2.2. Authorization in the studioQuestion 2.3. User setupProblem 3. Hello worldQuestion 3.1. ProjectQuestion 3.2. LaunchConclusion↑ Problem 1. Installation
Although the Caché installation is fairly transparent, there are still some questions regarding the installation.
↑ Question 1.1. Way
- Is it possible to put Caché in a directory containing whitespace characters in its name?- Yes, you can. However, as far as I know, InterSystems recommends installing Caché so that the path to the installation directory does not contain whitespace characters.
↑ Question 1.2. System user
- Why are I asked to specify a password for some system user? I just put the development environment?- In fact, installing Caché, you install not just a development environment, but a whole “ecosystem” that needs to be set up for security and privacy. This password, which must be specified, is the password of the system user, roughly speaking, the administrator of this ecosystem.
↑ Problem 2. Getting Started
Well, we installed Caché. What's next? How to start? Where to begin?
Among the tools that are available after installation, the following can be considered basic:
- "Caché Terminal",
- “Caché Studio”,
- "Caché Management Portal".
Caché Studio is the IDE (development environment), the main development tool in Caché ObjectScript.
Caché Terminal is a small command interface to Caché. In the terminal, you can enter commands and see the results of their execution. The terminal, in its essence, is a
REPL (
Read-Eval-Print Loop ).
Caché Management Portal is a Caché monitoring and management tool using a web interface.
↑ Question 2.1. Start
“Okay, how do I start writing code?”- To do this, open a studio, select an area, create a project, and start working on classes.
↑ Question 2.2. Authorization in the studio
- I opened the studio, and there they ask for a username and password. What is there to enter?- It is necessary to enter the login and password of a user known to Caché. At this stage there are two options: correct and undesirable.
An undesirable option is that you can enter your login in the Windows operating system, and the password is the one you specified for the system user during the installation process.
The correct option will require a little more effort, but it will protect you from the critical consequences that could have happened if something went wrong while you are logged in with an account with such an extensive set of rights and privileges.
In the future, the
"user " I will denote the user Caché, whose login matches the username of your operating system user.
↑ Question 2.3. User setup
- How to set up a user?- The correct path consists of several steps. I think that first of all it is necessary to change the user's password, then, lower the rights and privileges, and further set up the area for further work.
To do this, you need to open the Caché Management Portal, you can do it, for example, through the "Start panel" or through the traybar.
Method 1. Start panelStart -> All Applications -> Caché (start the portal).

Method 2. TreybarFind the Caché icon and launch the portal.


After we launch the portal, we will be met by the Caché security monitoring system.
At this time, enter the system user data. In the login field, specify
_system , and in the password field, enter the password you specified for the system user during installation.
After entering the portal you will see the main page of the portal. Please note that the portal shows you what user you are logged in to.
Now you need to open the user management page.
The user management page provides a list of users. Find yours there. This is done quite easily, if you pay attention to the column "Full Name", your user should have a comment in this column that he installed Caché. As you can see in the picture, my user is
jxcoder .
If you click on your username, then you will see a page for editing user information.
Specify a new user password.
Specify the
USER area for your future projects and data.
Click the
"Save" button.
Click the Roles tab. Now your user has one omnipotent role:
% All .
At the beginning of working with Caché, you will have enough of a simpler role:
% Developer .
Let's now see what we did. Log out of the portal by clicking the "Logout" button at the top of the web interface.
You will see the authorization form again. Enter your username and the new password you specified. After logging in to the portal, please note that administrative functions are not available to you.
The
% Developer role allows you to perform all necessary actions during development and debugging.
↑ Problem 3. Hello world
When meeting with any programming language, the first thing I want to try is to write a program that displays “Hello world!”.
To do this, you need to open Caché Studio (via the traybar or the Start panel). When Caché Studio starts, you will again be asked for your login and password. Specify the same information that you used to log into the portal. After that, you will be asked what area you want to use for your projects. Select the
USER area.
↑ Question 3.1. Project
- I want to write Hello World! Where do I begin?- Start with the project. Open Caché Studio (via treybar or “Start panel”) and create a project! You can call it
HelloWorld.prj .
In fact, you always work in a project, even if you have not explicitly created it. However, if we talk about a good tone, then a project with a meaningful name is still worth creating.
Now we need to create a class in which the body of the “Hello World” program will be contained.
In the window that appears, specify the following data about the class:
Package: HelloWorld
Name: Main
Click the “Finish” button and save the project (File -> Save All).
Now we can start writing the
Hello World program.
Place the following code in the
Main.cls file:
Class HelloWorld.Main { // main ClassMethod main() { // "Hello World!" write "Hello World!" } }
Now you need to compile the project (Build -> Rebuild All). Our
Hello World program is ready!
↑ Question 3.2. Launch
- I wrote the program Hello World! How do I run it?- Open the Caché Terminal (via the traybar or “Start Panel”). You will again be asked to log in. Enter your username and password. Note that after logging in, you are in the
USER area .
To start the program, enter the following command in the terminal:
do ##class(HelloWorld.Main).main()
After executing this command, you should notice the appearance of the string “Hello World!” On the screen.
This command literally means to run the
main method of the
Main class, which is in the
HelloWorld package. Note that the names of the packages, classes, and methods are case-sensitive.
That's all!
↑ Conclusion
In this article, I answered some of the most simple, but very typical questions for novice Caché ObjectScript developers.
In conclusion, I would like to indicate the resources that may be useful for novice developers: