Beta

Slashdot: News for Nerds

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Mini rant: Stupid constants

Chacham (981) writes | about 8 months ago

User Journal 0

I am looking at a stored PROCEDURE as it takes too long to run. Besides the CURSORs, DECODE()s where NVL() should be used, and a UNION, there exists this stupidity up front:

csSpace CONSTANT CHAR(1) :='';
cnZero CONSTANT NUMBER(1) :=0;

How many things can you spot that is just plain wrong with that?

I am looking at a stored PROCEDURE as it takes too long to run. Besides the CURSORs, DECODE()s where NVL() should be used, and a UNION, there exists this stupidity up front:

csSpace CONSTANT CHAR(1) :='';
cnZero CONSTANT NUMBER(1) :=0;

How many things can you spot that is just plain wrong with that?

  1. It uses the misunderstanding of Hungarian notation.
  2. It uses Hungarian notation for a constant
  3. The constant is not an uppercase
  4. The contant says what its value is, as opposed to it itself is
  5. It uses CHAR(1) (In Oracle VARCHAR2 there is no benefit to CHAR over VARHAR2)

Why is it that good programmers exist only in forums and newgroups, but not in the real world?

cancel ×

0 comments

Check for New Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account

Loading...