Total members 11895 |It is currently Sun Dec 22, 2024 10:28 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Data Type in Programming!!

Here I am sharing some of my early experiences in Programming. When we write code for any application, generally we concentrate on Business Logic and different features available to meet the Business Logic. Whatever applications we are working on, we are ultimately playing with data .The placeholder for the Data is the variables/fields/properties, etc. When we are declaring data type for a variable, generally we don’t give much emphasis at that point. Here some points we need to take care
My Experience No 1:

I declared a variable as “int” data type for a PatientId. It worked fine in local, but when that code went to LIVE, the application gave exception because in LIVE PatientId is too long to accommodate in int data type.

So before declaring any variable we need to consider all the situations, application scope, environment .Even one code may be working fine today, after 1/ 10/20 days/months/years it will fail due to just due to data type declaration mistake.

Think more; write less is the policy for better programming.

My Experience No 2:

I declared a variable as int data type which was a placeholder for a result status (meaning, based on the result status that variable varies from 0/1/2/3. It can contain only these four values).

“int” data type is 4 byte integer in C#. But I can declare this variable as “sbyte” which represents a 1 byte integer. Since that variable contains only 1 or 2 or 3 or 4, declaring the variable as “int” is wastage of memory space.

Before declaring any variable we need to just think of the memory space needed for that variable, our requirement, any other good alternative for this variable.

Eliza

http://www.mindfiresolutions.com/Data-Type-in-Programming-426.php




Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Data Type in Programming
 range of data type     -  
 Is String a data type     -  
 Type Conversion     -  
 Type conversions     -  
 set MIME type in link     -  
 range of the short type     -  
 range of the char type     -  
 Boolean type constant     -  
 Create Object and get its type     -  
 String type default value     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com