Data Type Tips
int, shortint, short, smallint are a few names taken from only two programming languages that indicate a two byte signed integer.
The names and storage mechanisms for various kinds of data have become as varied as the colors of leaves in New England in the fall. This really isn't so bad if you spend all your time programming in just one language. However if you're like most developers, you are probably using a number of languages and technologies which requires you to write code to convert data from one data type to another frequently.
Many developers for one reason or another resort to using “Variant” data types which further complicate matters, require more CPU processing and are usually abused.
You can ease data type complexity when writing conversions by using an apples to apples common reference point to describe data in much the same way that many countries with varied cultures and tongues have a common language which to speak. The benefit of designing your code around such an idea results in modular reusable code that makes sense and centralizes data conversion to one place.
The following datatypes are commonplace and can store just about anything:
b – boolean – True or False
u1 - unsigned integer – one byte u2 - unsigned integer – two byte u4 - unsigned integer – four byte u8 - unsigned integer – eight byte
i1 – integer – one byte i2 – integer – two byte i4 – integer – four byte i8 – integer – eight byte
f – float – four byte d – double – eight byte
s – string – undetermined length sx – string fixed length
us – unicode string - undetermined length ux – unicode string – fixed length
bin – unspecified binary object
The trick is to write code to convert your various data types to your “common tongue” and alternately write code to convert them back. If you do this for the various systems in your organization you will have a data type conversion code base that can move data to and from every system you did this for. This will speed data conversion tremendously.
This same technique works for moving data to and from disparate database software, accounting SDK interfaces, CRM systems and more.
Now converting and moving complex data types such as record structures, linked lists, database tables obviously complicates things however the same principles apply. Whenever you create a staging area whose layout is well defined like the datatypes listed above, and write code to move data into a structure from a given source as well as the mechanism to move it back, you create valuable programming opportunities.
Most organizations are very aware of the fetters that vendor lock-in creates, and by devising a common tongue for all your systems to speak in, you manufacture a powerful tool to loosen those bonds.
The details may be in the data, but the data is stored in your datatypes.