Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
Discussion Evgeny Shvarov · Jan 24, 2018

For and If with one line: to brace or not to brace

Hi Community!

Coding guidelines discussion. Consider you have For with one command in the cycle. Here are the options:

One

For i=1:1:1000 set ^Test(i)=""

Two

For i=1:1:1000 {
 set ^Test(i)=""
}

Same for the "If":

if a set b=a

or

if a {
 set b=a
}

Your choice? Or maybe even other options? 

Comments

Dmitry Maslennikov  Oct 22, 2019 to Stephen Wilson
// Changes the max-limit on the process memory from the default 16384 Kilobytesset $ZS=49152

It's already 256Mb, since 2012.2

0
Stephen Wilson  Oct 23, 2019 to Dmitry Maslennikov

Strange. Our production servers are Caché 2018 on AIX but still showing only 16,384 KB.
Must have preserved the existing setting on upgrades rather than use the new value.
Fresh local Caché install on Windows install shows 256MB though. 

%SYS>w $zv                                                            
Cache for UNIX (IBM AIX for System Power System-64) 2018.1.2 (Build 309_5) Wed Jun 12 2019 20:08:03 EDT                                                        
%SYS>w $zs
16384         
 
0
Eduard Lebedyuk  Oct 18, 2019 to Developer Community Admin

Which part of it?

There's like 5 different suggestions contradicting each other.

0
Kurro Lopez  Oct 18, 2019 to Eduard Lebedyuk

None of them. The best practices is "Do what you want"... hehe

Now seriously. I think the best practices is use according to the explication of each comment. Use brace to delimit the scope, not use if you have one line and precondition, etc..

0
Evgeny Shvarov  Oct 18, 2019 to Eduard Lebedyuk

The conversation is helpful.

0
Evgeny Shvarov  Oct 18, 2019 to Eduard Lebedyuk

Ok, this is fair - we can remove the Best Practice tag for this. 

The idea was that this is important conversation if you consider internal guidelines on this for your organization and can take one approach from the best practices of experienced developers.

0
Kurro Lopez  Oct 19, 2019 to Evgeny Shvarov

I think it is a "Best practice", but the information is scattered throughout the conversation.

Why not create a last comment with a brief of the conversation, with pros and cons?

It could be more clear.

Regards
 

0