Search DominoPower's 11,443 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 (84 articles)
   A walk down Memory Lane with Lotus Notes
   An application for scanning physical mail and distributing it virtually
   Managing Notes deployments with Teamstudio Build Manager
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 (102 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   A faster way to repair corrupted server files
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
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
Syncing Notes with Android phones
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- 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.
-- Advertisement --

Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.

Register by April 10 to save $200.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login