SlideShare a Scribd company logo
1 of 17
Software Metrics
 A software metric is a measure of software characteristics which are
measurable or countable.
4/16/2024 Dr. Ashish Kumar Sahu 2
Goals of Coding
1. To translate the design of system into a computer language format
2. To reduce the cost of later phases
3. Making the program more readable
Program should be easy to read and understand.
4/16/2024 Dr. Ashish Kumar Sahu 3
Characteristics of Programming Language
4/16/2024 Dr. Ashish Kumar Sahu 4
1. Portability
High-level languages, being virtually machine-independent, should be easy to develop
portable software.
2. Modularity
It is desirable that programs can be developed in the language as several separately
compiled module.
3. Error checking
By using try catch block in JAVA
4. Clarity and Readability
A good programming language should have syntax and structure that are easy to
understand.
4/16/2024 Dr. Ashish Kumar Sahu 5
6. Scalability
Insuring they can handle increased workloads without compromising performance.
7. Abstraction
enable developers to work at higher levels without getting bogged down by unnecessary
details.
4/16/2024 Dr. Ashish Kumar Sahu 6
Coding Standards
4/16/2024 Dr. Ashish Kumar Sahu 7
 Indentation: Proper and consistent indentation is essential in
producing easy to read and maintainable programs.
Indentation should be used to:
 Emphasize the body of a control structure such as a loop or a select statement.
 Emphasize the body of a conditional statement
 Emphasize a new scope block
 Inline comments: Inline comments analyze the functioning of the
subroutine, or key aspects of the algorithm shall be frequently used.
 Rules for limiting the use of global: These rules file what types of
data can be declared global and what cannot.
4/16/2024 Dr. Ashish Kumar Sahu 8
 Naming conventions for global variables, local variables, and
constant identifiers: A possible naming convention can be that global
variable names always begin with a capital letter, local variable names
are made of small letters, and constant names are always capital
letters.
 Error return conventions and exception handling system: Different
functions in a program report the way error conditions are handled
should be standard within an organization. For example, different tasks
while encountering an error condition should either return a 0 or 1
consistently.
4/16/2024 Dr. Ashish Kumar Sahu 9
Structured Programming: Structured (or Modular) Programming
methods shall be used. "GOTO" statements shall not be used.
4/16/2024 Dr. Ashish Kumar Sahu 10
Coding Guidelines
General coding guidelines provide the programmer with a set of the best
methods which can be used to make programs more comfortable to read
and maintain.
4/16/2024 Dr. Ashish Kumar Sahu 11
1. Line Length: It is considered a good practice to keep the length of
source code lines at or below 80 characters. Lines longer than this
may not be visible properly on some terminals and tools.
2. Spacing: The appropriate use of spaces within a line of code can
improve readability
 Bad: cost=price+(price*sales_tax)
fprintf(stdout ,"The total cost is %5.2fn",cost);
 Better: cost = price + ( price * sales_tax )
fprintf (stdout,"The total cost is %5.2fn",cost);
4/16/2024 Dr. Ashish Kumar Sahu 12
3. The code should be well-documented: As a rule of thumb, there
must be at least one comment line on the average for every three-source
line.
4. The length of any function should not exceed 10 source lines: A
very lengthy function is generally very difficult to understand as it
possibly carries out many various functions. For the same reason,
lengthy functions are possible to have a disproportionately larger
number of bugs.
4/16/2024 Dr. Ashish Kumar Sahu 13
5. Do not use goto statements: Use of goto statements makes a
program unstructured and very tough to understand
6. Inline Comments: Inline comments promote readability.
7. Error Messages: Error handling is an essential aspect of computer
programming.
4/16/2024 Dr. Ashish Kumar Sahu 14
Programming Style
1. Clarity and simplicity of Expression: The programs should be
designed in such a manner so that the objectives of the program is
clear.
 2. Naming: In a program, you are required to name the module,
processes, and variable, and so on. Care should be taken that the
naming style should not be cryptic and non-representative.
 For Example: a = 3.14 * r * r
area_of_circle = 3.14 * radius * radius;
4/16/2024 Dr. Ashish Kumar Sahu 15
3. Control Constructs: It is desirable that as much as a possible single entry
and single exit constructs used.
4. Information hiding: The information secure in the data structures should
be hidden from the rest of the system where possible. Information hiding can
decrease the coupling between modules and make the system more
maintainable.
5. Nesting: Deep nesting of loops and conditions greatly harm the static and
dynamic behavior of a program. It also becomes difficult to understand the
program logic, so it is desirable to avoid deep nesting.
6. User-defined types: Make heavy use of user-defined data types like enum,
class, structure, and union. These data types make your program code easy to
write and easy to understand.
4/16/2024 Dr. Ashish Kumar Sahu 16
7. Module size: The module size should be uniform. The size of the
module should not be too big or too small. If the module size is too
large, it is not generally functionally cohesive. If the module size is too
small, it leads to unnecessary overheads.
4/16/2024 Dr. Ashish Kumar Sahu 17

More Related Content

Similar to Software Coding for software engineering

Coding standard and coding guideline
Coding standard and coding guidelineCoding standard and coding guideline
Coding standard and coding guidelineDhananjaysinh Jhala
 
IRJET - Code Compiler Shell
IRJET -  	  Code Compiler ShellIRJET -  	  Code Compiler Shell
IRJET - Code Compiler ShellIRJET Journal
 
Coding standards
Coding standardsCoding standards
Coding standardsMimoh Ojha
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementationghayour abbas
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementationghayour abbas
 
Software engineering introduction
Software engineering introductionSoftware engineering introduction
Software engineering introductionVishal Singh
 
PCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptxPCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptxvishnupriyapm4
 
Airline ticket reservation system
Airline ticket reservation systemAirline ticket reservation system
Airline ticket reservation systemSH Rajøn
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptxDivyaKS12
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure rupeshchanchal
 
9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdfOprim Solutions
 
Software enginneering
Software enginneeringSoftware enginneering
Software enginneeringchirag patil
 
LearningOutcomesassessedin
LearningOutcomesassessedinLearningOutcomesassessedin
LearningOutcomesassessedinJospehStull43
 
Introduction of Software Engineering
Introduction of Software EngineeringIntroduction of Software Engineering
Introduction of Software EngineeringZafar Ayub
 
PCCF UNIT 2.pptx
PCCF UNIT 2.pptxPCCF UNIT 2.pptx
PCCF UNIT 2.pptxDivyaKS12
 

Similar to Software Coding for software engineering (20)

Coding standard and coding guideline
Coding standard and coding guidelineCoding standard and coding guideline
Coding standard and coding guideline
 
IRJET - Code Compiler Shell
IRJET -  	  Code Compiler ShellIRJET -  	  Code Compiler Shell
IRJET - Code Compiler Shell
 
Coding standards
Coding standardsCoding standards
Coding standards
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementation
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementation
 
Software engineering introduction
Software engineering introductionSoftware engineering introduction
Software engineering introduction
 
PCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptxPCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptx
 
Airline ticket reservation system
Airline ticket reservation systemAirline ticket reservation system
Airline ticket reservation system
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
 
SE2018_Lec 17_ Coding
SE2018_Lec 17_ CodingSE2018_Lec 17_ Coding
SE2018_Lec 17_ Coding
 
9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf
 
Software enginneering
Software enginneeringSoftware enginneering
Software enginneering
 
Ch05
Ch05Ch05
Ch05
 
LearningOutcomesassessedin
LearningOutcomesassessedinLearningOutcomesassessedin
LearningOutcomesassessedin
 
Software coding and testing
Software coding and testingSoftware coding and testing
Software coding and testing
 
Introduction of Software Engineering
Introduction of Software EngineeringIntroduction of Software Engineering
Introduction of Software Engineering
 
SE2_Lec 18_ Coding
SE2_Lec 18_ CodingSE2_Lec 18_ Coding
SE2_Lec 18_ Coding
 
PCCF UNIT 2.pptx
PCCF UNIT 2.pptxPCCF UNIT 2.pptx
PCCF UNIT 2.pptx
 

Recently uploaded

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Recently uploaded (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

Software Coding for software engineering

  • 2.  A software metric is a measure of software characteristics which are measurable or countable. 4/16/2024 Dr. Ashish Kumar Sahu 2
  • 3. Goals of Coding 1. To translate the design of system into a computer language format 2. To reduce the cost of later phases 3. Making the program more readable Program should be easy to read and understand. 4/16/2024 Dr. Ashish Kumar Sahu 3
  • 4. Characteristics of Programming Language 4/16/2024 Dr. Ashish Kumar Sahu 4
  • 5. 1. Portability High-level languages, being virtually machine-independent, should be easy to develop portable software. 2. Modularity It is desirable that programs can be developed in the language as several separately compiled module. 3. Error checking By using try catch block in JAVA 4. Clarity and Readability A good programming language should have syntax and structure that are easy to understand. 4/16/2024 Dr. Ashish Kumar Sahu 5
  • 6. 6. Scalability Insuring they can handle increased workloads without compromising performance. 7. Abstraction enable developers to work at higher levels without getting bogged down by unnecessary details. 4/16/2024 Dr. Ashish Kumar Sahu 6
  • 7. Coding Standards 4/16/2024 Dr. Ashish Kumar Sahu 7
  • 8.  Indentation: Proper and consistent indentation is essential in producing easy to read and maintainable programs. Indentation should be used to:  Emphasize the body of a control structure such as a loop or a select statement.  Emphasize the body of a conditional statement  Emphasize a new scope block  Inline comments: Inline comments analyze the functioning of the subroutine, or key aspects of the algorithm shall be frequently used.  Rules for limiting the use of global: These rules file what types of data can be declared global and what cannot. 4/16/2024 Dr. Ashish Kumar Sahu 8
  • 9.  Naming conventions for global variables, local variables, and constant identifiers: A possible naming convention can be that global variable names always begin with a capital letter, local variable names are made of small letters, and constant names are always capital letters.  Error return conventions and exception handling system: Different functions in a program report the way error conditions are handled should be standard within an organization. For example, different tasks while encountering an error condition should either return a 0 or 1 consistently. 4/16/2024 Dr. Ashish Kumar Sahu 9
  • 10. Structured Programming: Structured (or Modular) Programming methods shall be used. "GOTO" statements shall not be used. 4/16/2024 Dr. Ashish Kumar Sahu 10
  • 11. Coding Guidelines General coding guidelines provide the programmer with a set of the best methods which can be used to make programs more comfortable to read and maintain. 4/16/2024 Dr. Ashish Kumar Sahu 11
  • 12. 1. Line Length: It is considered a good practice to keep the length of source code lines at or below 80 characters. Lines longer than this may not be visible properly on some terminals and tools. 2. Spacing: The appropriate use of spaces within a line of code can improve readability  Bad: cost=price+(price*sales_tax) fprintf(stdout ,"The total cost is %5.2fn",cost);  Better: cost = price + ( price * sales_tax ) fprintf (stdout,"The total cost is %5.2fn",cost); 4/16/2024 Dr. Ashish Kumar Sahu 12
  • 13. 3. The code should be well-documented: As a rule of thumb, there must be at least one comment line on the average for every three-source line. 4. The length of any function should not exceed 10 source lines: A very lengthy function is generally very difficult to understand as it possibly carries out many various functions. For the same reason, lengthy functions are possible to have a disproportionately larger number of bugs. 4/16/2024 Dr. Ashish Kumar Sahu 13
  • 14. 5. Do not use goto statements: Use of goto statements makes a program unstructured and very tough to understand 6. Inline Comments: Inline comments promote readability. 7. Error Messages: Error handling is an essential aspect of computer programming. 4/16/2024 Dr. Ashish Kumar Sahu 14
  • 15. Programming Style 1. Clarity and simplicity of Expression: The programs should be designed in such a manner so that the objectives of the program is clear.  2. Naming: In a program, you are required to name the module, processes, and variable, and so on. Care should be taken that the naming style should not be cryptic and non-representative.  For Example: a = 3.14 * r * r area_of_circle = 3.14 * radius * radius; 4/16/2024 Dr. Ashish Kumar Sahu 15
  • 16. 3. Control Constructs: It is desirable that as much as a possible single entry and single exit constructs used. 4. Information hiding: The information secure in the data structures should be hidden from the rest of the system where possible. Information hiding can decrease the coupling between modules and make the system more maintainable. 5. Nesting: Deep nesting of loops and conditions greatly harm the static and dynamic behavior of a program. It also becomes difficult to understand the program logic, so it is desirable to avoid deep nesting. 6. User-defined types: Make heavy use of user-defined data types like enum, class, structure, and union. These data types make your program code easy to write and easy to understand. 4/16/2024 Dr. Ashish Kumar Sahu 16
  • 17. 7. Module size: The module size should be uniform. The size of the module should not be too big or too small. If the module size is too large, it is not generally functionally cohesive. If the module size is too small, it leads to unnecessary overheads. 4/16/2024 Dr. Ashish Kumar Sahu 17