We help IT Professionals succeed at work.

Coding Best practices Question

mte01
mte01 asked
on
443 Views
Last Modified: 2012-02-15
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 ?
Comment
Watch Question

Top Expert 2012
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.