Search DominoPower's 10,675 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
PROGRAMMING POWER
Numeric vs. text fields in application design
By Mick Moignard

One thing I see all too often in application design, and this isn't just Lotus Notes application design, is the horrible misuse of the Numeric data type.

Indeed, I had an example of this just recently. We had a field that was defined all the way through the application as a numeric field, and it had "numeric" values. We needed to make a change to allow the user to select a field value from a keyword list, and as I'm sure you all know, keyword list fields are, by definition, text.

"That one usually comes home to roost about a week after going in to production."

That this field was really a text field was drummed in by the fact that the selections the end-user was making were indeed textual descriptions -- actually of the levels of health-care required in a given situation -- and the "numeric" value stored was an internal coded value, a synonym, for that.

Back in the day
When I was just starting out in programming, it was pointed out to me in no uncertain terms that the various numeric data types that mainframe PL/I supported were all there to enable arithmetic operations on their values. That there were many different representations of numbers, fixed-point decimal and various sizes of binary fields wasn't particularly relevant to the issue.

They all existed to provide a balance between number size, scale, precision, and, if you were doing decimal operations, accuracy -- that last because binary fields only generate approximate decimal values at the far right-hand end. But they all stored numeric values that allowed for computation.

Nowadays, we have in Lotus Notes far fewer choices of numeric fields, but the same rule should apply in application design and programming: that number fields should only be used to contain data that is to be manipulated arithmetically, and for no other purpose. There are a whole pile of good reasons for this.

Understanding emptiness
Firstly, conventional numbers don't really have the concept that a string does, of the value "". In Lotus Notes, a string containing "" means that the field has no value. Strictly, that is not the same as "blank". "Blank" implies that the field contains at least one space character, or " ".

Some programming languages like PL/I have the concept of fixed-length fields, and such a string field actually cannot contain the "" value at all. With a fixed length, assigning "" to it will generate a string of all blanks, and that's not the same as "empty". But more importantly for this argument, a number field containing 0, zero, has the numeric value zero, which is a real value and is most definitely not the same as "empty".


1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > Notes (78 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Troubleshooting an OpenSuse Notes install
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Home > Tips & Techniques (95 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Troubleshooting an OpenSuse Notes install
Home > Lotus Technologies > Application Development (47 articles)
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
   Integrating a Notes Connector database with Google Enterprise Search
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
What to look for in a Domino-based document management solution
Understanding Domino.doc end-of-life options
When the debugger won't debug hidden code that isn't hidden
What to do if the LotusScript debugger won't single-step over code
Top 10 ways to launch and build a Lotus consulting practice (with a little help from the Beatles)
Troubleshooting an OpenSuse Notes install
Incident report: denial of service attack against ConnectedPhotographer.com
Latest Lotus Headlines
SnTT - Enabling ALL the bells and whistles!
Tivoli Data protection causes Domino to crash
Fun when running DB2 CLP scripts
Introducing Flippr, the easy way to admin Quickr
DXL and fake security
Using search forms in IBM Workplace Collaborative Learning 2.7
Schmidt, Freed, and Gering on the OVF Toolkit
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Eight steps to successful and reliable home backups
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Can Outlook run when it's not running (and other mysteries)?
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2009, ZATZ Publishing. All rights reserved worldwide.
Editor's Login