Software Engineering Concepts, Lecture notes of Software Engineering

Coding Standards for software engineers

Typology: Lecture notes

2018/2019

Uploaded on 05/04/2019

sumayyakhaan
sumayyakhaan 🇵🇰

2 documents

1 / 56

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Department Of Computer Science
Software Engineering Concepts-CSC291-Fall-2018 Mr. Tehseen Riaz Abbasi 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38

Partial preview of the text

Download Software Engineering Concepts and more Lecture notes Software Engineering in PDF only on Docsity!

Department Of Computer Science

Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi 1

Lecture - 10 CODING Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi (^2)

Important design considerations ◼ Support multiple skill levels ◼ Minimize memorization ◼ Design based on metaphors ◼ Most common operations should be organized such that: ◼ these are fastest to detect and use. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Coding Phase ◼ Coding is undertaken once design phase is complete. ◼ During coding phase: ◼ every module identified in the design document is coded and unit tested. ◼ Unit testing (aka module testing): ◼ testing of different modules (aka units) of a system in isolation. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Coding

◼ At the end of the design phase we have: ◼ module structure (e.g. structure chart) of the system ◼ module specifications:

◼ data structures and algorithms for each module.

◼ Objective of coding phase: ◼ transform design into code ◼ unit test the code. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Coding Standards ◼ Good software development organizations require their programmers to: ◼ adhere to some standard style of coding ◼ called coding standards. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Coding Standards ◼ Advantage of adhering to a standard style of coding: ◼ it gives a uniform appearance to the codes written by different engineers, ◼ it enhances code understanding, ◼ encourages good programming practices. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Coding Standards ◼ A coding standard ◼ sets out standard ways of doing several things: ◼ the way variables are named, ◼ code is laid out, ◼ maximum number of source lines allowed per function, etc. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Code inspection and code walk throughs ◼ After a module has been coded, ◼ code inspection and code walk through are carried out ◼ ensures that coding standards are followed ◼ helps detect as many errors as possible before testing. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

◼ Detect as many errors as possible during inspection and walkthrough: ◼ detected errors require less effort for correction ◼ much higher effort needed if errors were to be detected during integration or system testing. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi Code inspection and code walk throughs

Representative Coding Standards ◼ Rules for limiting the use of globals: ◼ what types of data can be declared global and what can not. ◼ Naming conventions for ◼ global variables, ◼ local variables, and ◼ constant identifiers. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Representative Coding Standards ◼ Contents of headers for different modules: ◼ The headers of different modules should be standard for an organization. ◼ The exact format for header information is usually specified. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Representative Coding Standards ◼ Error return conventions and exception handling mechanisms. ◼ the way error and exception conditions are handled should be standard within an organization. ◼ For example, when different functions encounter error conditions ◼ should either return a 0 or 1 consistently. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi

Representative Coding Guidelines ◼ Do not use too clever and difficult to understand coding style. ◼ Code should be easy to understand. ◼ Many inexperienced engineers actually take pride: ◼ in writing cryptic and incomprehensible code. Software Engineering Concepts-CSC291-Fall- 2018 Mr. Tehseen Riaz Abbasi