troubleshooting Question

Coding Best practices Question

Avatar of mte01
mte01Flag for Lebanon asked on
MySQL Server
2 Comments2 Solutions449 ViewsLast Modified:
Hello,
Can you inform me which practice is more professional?

Note: rsendORU is read from the database and have a numerical values (0, 1, 2, 3…)
0 means not assigned
1 OOI PACS server
2…

So I created constants for 1, 2, … and used them in my code
Note that for now, these constants are used only once and anyone in our team that see OOIPACS will understand that this is an OOI Pacs server :)

OOIPACS = 1
And in my code:
        # In case 'OOIPACS' is selected from the Send ORU drop down of the matching rule, then send the ORU
        if (rsendORU == OOIPACS):
            processORIMessage(rule, studyUID, dbimage, DestAETitle)


Would it be better to skip creating the constants and use a proper comments before the if statements?
Code becomes:
        # In case 'OOIPACS' is selected from the Send ORU drop down of the matching rule, then send the ORU
        if (rsendORU == 1): # OOI Pacs server
            processORIMessage(rule, studyUID, dbimage, DestAETitle)

What do you think? Which one is clearer and friendlier ?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros