The topic of for/while loop performance in Caché ObjectScript came up in discussion recently, and I'd like to share some thoughts/best practices with the rest of the community. While this is a basic topic in itself, it's easy to overlook the performance implications of otherwise-reasonable approaches.

24 21
3 9K

Hi Community!

Sometimes I meet a method which accepts 10+ parameters.

And often I need only the 8th parameter to pass. And I call the method something like:

do ##class(Some.Feature).Method(,,,,,,,"flag")

And I don't like this method when I call it like this cause, you know, often I just miss the number of commas and raise some other flag I wanted.

How do you avoid this situations?

If you meet such a code, how do you call it and sure that you didn't miss the number of ","?

What is a good number of parameters in a method and f you need to pass more parameters in a method what do you do?

3 27
1 1.5K

I am trying to write an application that will take some information on the database make a call to the Google API distance matrix and get the information to use with rest of the application without using the ensemble part of the development is this possible and how can I do my communication with the API from a cache class thanks in advance

0 7
0 1.3K
Question
· Jul 25, 2020
Abstract Classes and Methods

I have been looking into using abstract classes and methods. In other languages, if a superclass is defined as abstract, subclasses inheriting from the superclass will not compile until all abstract methods have been implemented in the subclass.
I have created the following classes to try this in Cache:
Class User.Music.AbstractClass [ Abstract ]
{

0 8
0 1.1K
Announcement
· May 21, 2018
How is your code health

As a developer, usually I'm concerned about how my code health is, and how the other coders code can affect to my own work. And I'm quite sure most of us feel very similar.

In our company we use a Static Code Analysis tool to analyze code for different languages to ensure we are writing high quality and easily maintainable code by following a few best practices in terms of code structure and content. And the question was: why should be different for Caché ObjectScript language?

6 3
4 1.1K

Hi! Today I would like to talk about one of the most important architectural patterns in Angular.

The pattern itself is not related to Angular directly, but as Angular is component-driven framework, this pattern is one of the most essential for building modern Angular applications.

Container-Presentation pattern

It is believed that good components should be small, focused, independent, testable and most important - reusable.

6 0
0 845

I understand RecordMaps can be used to send delimited files through a production without custom coding. The data segments are delimited by tilde character followed by $Char(10) in Linux/Unix. When I test the same IO data in Windows, I have $Char(13) and $Char(10) instead of just $Char(10). I like to use just tilde character for record delimiter and ignore $Char(13) and $Char(10) between the tilde and the leading data of the next segment / record. Is this good idea or not if someone wants to generate classes will it override code?

0 2
0 830

Hi,

I have a method that has multiple parameters and is normally used from other classes in ObjectScript. Most of the parameters have default values. Withing the server code that's perfect. In some areas I can call myMethod(,,"sometext") or myMethod(tVariab) and thats fine... I use it as it's required in each place.

But now I want to expose it as a REST service so I need to buld a kind of wrapper., another method in a REST dispatcher class that will receive the parameters in a JSON object and will call the server method already implemented. Something like:

0 3
0 722

I have multiple files with different columns, first 9 values are fixed, so i want to ignore the first value, and next 8 values i want to combine into one value using ^ sign

Current Format

|||||||||||^^||||||^^|||||||||||||||||
|||||||||||^^||||^^|||||||||||||||||||||||
|||||||||||^^|||^^||||||||

Desired Format

^^^^^^|||^^||||||^^|||||||||||||||||
^^^^^^|||^^||||^^|||||||||||||||||||||||
^^^^^^|||^^|||^^||||||||

Reading each line from the file use below code.

0 11
0 717

Hi community!

Is it possible generate HTML documentation to my project ObjectScript classes (.cls)?

In Java we use Javadoc to do it. Javadoc get class comments and java metadata information and when I execute javadoc -d doc src\*, I get whole html documentation to my classes. Has IRIS something like javadoc? Is it documatic? If yes, how can I use it?

1 12
2 583
Discussion
· Mar 19, 2019
Rule to validate SQL syntaxis

Hi! We have received a request to create a new rule on CachéQuality to identify when a developer uses double quotes (" ") within any SQL statement.

We have been asked many times about SQL validation rules, and we would like to open a debate to allow everyone discuss what would you like to be checked on a SQL statement.

Current examples are for basic situations:

0 13
0 534

Our development server is set up to automatically keep the .INT code of compiled classes and routines, but the live servers are set to not keep the .INT code.

I know how to set the system to keep this code ($SYSTEM.OBJ.SetQualifiers() ?) but what are the ramifications of keeping this code on the live servers? Is it just a space issue? I always thought it was to keep the code more private.

0 4
0 526

Hello,

I work on deploying IRIS inside Docker container. I really like %Installer class can automate many steps. I want to establish an ECP connection to a mirror database and then define a remote database on the application server. I have already seen we can create local database and namespace in %Installer. What code is needed to establish ECP connection?

0 6
0 524

A SOLID Design in Cache Object

In this session, we will discussing SOLID Principle of Programming and will implement in a example.
I have used Cache Object Programming Language for examples.
We will go step by step to understand the requirement, then what common mistakes we use to do while designing, understanding each principles and then complete design with its implementation via Cache Objects.

3 7
2 463

Say I have a property in a persistent class that stores list of colours and I would like to query that field and return a list and be able to loop that list to get individual colours how will l go about achieving this I have tried something like this but its not working as expected

 &sql(SELECT colour INTO :colourList FROM favouritecolours)
 While (SQLCODE = 0) 
{
 for i=1:1:$LENGTH($P(colourList,","))
 {
 set fvalue=$P(colourList,",",i) 
write "the first"_fvalue,i, 
} 
}
0 1
0 460