Code Design
•The purpose of code is to make the task easy for identification and retrieval of items of information when there are several items in the group
•In any computer system , data to be processed have codes so that sorting , retrieving , storing etc will become efficient
•Codes are necessary because
•Data is easily identified
•Data is simplified and standardized . Hence the number of mistakes are reduced to the extent possible.
•Data processing operations can be done easily
•It help to make the computer system work more efficently.
code
• A code is a group of character or digit that identify and describe an item. E.g. pin code number
• Codes are frequently used to describe customer , product , materials or events . Hence description of items is also needed. generally code number are referred to as key fields on transaction and records
• Principle of code design
– Uniqueness : code for any particular item is unique eg. grno of student
– Compactness: the length of code should be as minimum as possible . However code alone are not sufficent for easy identification and verification eg the codes mand f for male n female.
– Uniformity: uniform signs and format is highly desirable in mechanized data processing system.
– Expansibility: the code structure should allow growth. Enough room should be provided in the construction itself for accommodating possible future expansion
– Simplicity: the code should be simple to use and easy to understand by each user even with minimum experience
– Versatility : it should be easy to modify to reflect necessary changes in condition , characteristics and relationship of the encoded entities
– Clarification : for the user , sorted output data in a predetermined format is valuable although data must be sorted and collated , it representative code does not need to be in sortable form
– Stability: codes should not be updated or modified frequently
– Meanigfullness codes should be meaning ful code value should echo the characteristics of the encoded entities.
Significant codes
• In significant codes , digits or letter may describe a measurable or identifiable characteristics of the item . It is frequently used for coding inventory items
• E.g. in coding electric bulb for inventory purpose
• Product classification
– Bulbs
– 1 automobile
– 2 domestic use
– 3 clinical use
• Colour
– Colorless 1
– Milky 2
– Yellow 3
– Red 4
– Green 5
Wattage
25w 00025
40w 00040
100w 00100
E.g. the domestic use bulb of 100w of color red can
be coded as D400100
Logical codes(Digital codes)
• In digital code , the individual values are derived in conjunction with a consistent , well defined rate or procedure (algorithm)
• In logical codes we have 2 types
– Check digit code
– Matrix code
E.g. the following matrix gives the air line distance between the cities in km x->
1 2 3 4 1-Surat
1 0 220 100 1200 2-Mumbai
2 220 0 120 1420 3- vapi
3 100 120 0 1300 4-delhi
4 1200 1420 1300 0
The (x,y) coordinate (3,2) will refer to distance between mumbai and
vapi which is 120
Collating codes
• Collating codes are widely use code system the collating code structure is designed so that when sorted by code number, the item represented by the codes are placed in predetermine sequence
• Collating codes are of 4 types
– Alphabetic code: alphabetic coding requires placement of all items in alphabetical sequence, then assignment of code of ever increasing value.
1 deshpande vaishali vasudev
2 Bhagwad smitha sharad
2 Gavaskar sunil manohar
3 Agarwal amit dinesh
In allotting examination seat number these students can be given the number in alphabetic order which their surname appear
0001 Agarwal amit dinesh
0002 Bhagwad smitha sharad
0003 deshpande vaishali vasudev
0004 Gavaskar sunil manohar
• Advantages of alphabetic codes
– It is easy for sorting
– It is easy for maintenance
– With any initial encoding we can access the code
• Disadvantages of alphabetical codes
• All items will have to be encoded at one time to get reasonable spacing for new entries
• It has relatively short life
• There is necessity of central control for number issuing
Hierarchical codes
• It provides a top down interpretation for an item . Even item coded is factored into groups ,subgroups and so forth
• For e.g. region: eastern ,western , northern , southern , central(denote this by one character code E , W, S, N, C
• City : this will occupy position 2 to 4 in character(pune
– PUN, Nasik – NSK)
• Group: divided into manageable groups each group
can be denoted by 2 digit occupying 5 and 6 position
• Number : each salesman given 2 digit number
• A salesman with no 12 in group 3 in Nasik city belong to western region WNSK0312
Classification codes
• Classification codes place separate entities such as event, people, or object into distinct groups called classes
• A code is used to distinguish one class from another. A classification is by nature and order systematic structure
• Classification codes are 2 types
– Decimal code is useful when we cannot tell exact quantity of items to be coded used in libraries for uniquely coding the book
Subject code
Sociology 300
Philology 400
Physic 530
Mechanics 531
Machine 531.1
Level and bank 531.11
Pulley 531.14
Pulley compound 531.141
• Faceted codes : certain kind of classification code are known as faceted codes . This kind of code represent different facet of the decoded item each
facet is given as many characters as required
• E.g. footwear manufacturers code can have it facets type sex size style material
(shoes SH (M/F) (1 to 10) (3 digit (Three char
Chappal CH) code) PLA,LEH,RUB
Chronological codes
• As the name suggest this code is assigned in the order of events so that each code has a higher value than the last code assigned e.g. list of students according to date of birth
• Abbreviation : many times coding is done by taking the abbreviation of the name of an entity there are 2 method of doing this
– Mnemonic : it means assisting the memory . The code should help to convey the meaning quickly to the user eg 21 inch color tv –TV –CL -21, mca master of computer application
– Acronyms codes : it is a particular type of mnemonic representation constructed from the first letter or letters of several words eg WHO world health organization ,FORTRAN formula translation.
Non significant codes
• A non significant code conveys no information by itself eg a range of number may be allocated to customer, account codes etc
• Non significant are of 2 types
– Sequential codes ( serial or tag code) they are either number or letters assigned in series they tell the order in which events have occurred e.g. numbering in pass book is done sequentially
– The code value has no significance in itself but does uniquely identify the entity
– It makes no provision for classifying groups of like item
– A set of sequential code is divided into blocks that classify them into
specific classes
Steel rod : 0001 to 0170
Steel pipe : 0171 to 0340
Steel plates : 0341 to 0500
• Random code : is drawn from a number list which is not detectable in order of sequence
• Lists are available in statistical table or can be generated through a computer program
• In this method each additional item may not be given next serial number
• No logical way to predict the next number
• Random coder may be used in case where security of data is needed since method is cumbersome not in much practice.
Additional points in code design
• Hyphens, commas and other wild characters should be avoided in code
• It should not be too lengthy a code of length 12 is difficult to handle
• The coding should enable fast processing by computer
• If data is common then code used in one subsystem should be applicable in other subsystem as well.