SlideShare a Scribd company logo
Principles of Programming
and Software Engineering
1-1
 Coding without a solution design increases
debugging time
 A team of programmers for a large software
development project involves
 An overall plan
 Organization
 Communication
 Software engineering
 Provides techniques to facilitate the development of
computer programs
1-2
 Problem solving
 The process of taking the statement of a problem and
developing a computer program that solves that
problem
 A solution consists of:
 Algorithms
 Algorithm: a step-by-step specification of a function to solve
a problem within a finite amount of time
 Ways to store data
1-3
1-4
Figure 1.1
The life cycle of software as a waterwheel that can rotate from one phase to any other phase
 Phase 1: Specification
 Aspects of the problem which must be specified:
 What is the input data?
 What data is valid and what data is invalid?
 Who will use the software, and what user interface should be
used?
 What error detection and error messages are desirable?
 What assumptions are possible?
 Are there special cases?
 What is the form of the output?
 What documentation is necessary?
 What enhancements to the program are likely in the future?
1-5
 Phase 1: Specification (Continued)
 Prototype program
 A program that simulates the behavior of portions of the
desired software product
 Phase 2: Design
 Includes:
 Dividing the program into modules
 Specifying the purpose of each module
 Specifying the data flow among modules
1-6
 Phase 2: Design (Continued)
 Modules
 Self-contained units of code
 Should be designed to be:
 Loosely coupled
 Highly cohesive
 Interfaces
 Communication mechanisms among modules
1-7
 Phase 2: Design (Continued)
 Specifications of a function
 A contract between the function and the module that calls it
 Should not commit the function to a particular way of
performing its task
 Include the function’s preconditions and postconditions
 Phase 3: Risk Analysis
 Building software entails risks
 Techniques exist to identify, assess, and manage the
risks of creating a software product
1-8
 Phase 4: Verification
 Formal methods can be used to prove that an algorithm
is correct
 Assertion
 A statement about a particular condition at a certain point in
an algorithm
 Invariant
 A condition that is always true at a particular point in an
algorithm
1-9
 Phase 4: Verification (Continued)
 Loop invariant
 A condition that is true before and after each execution of an
algorithm’s loop
 Can be used to detect errors before coding is started
 The invariant for a correct loop is true:
 Initially, after any initialization steps, but before the loop begins
execution
 Before every iteration of the loop
 After every iteration of the loop
 After the loop terminates
1-10
 Phase 5: Coding (Continued)
 Involves:
 Translating the design into a particular programming
language
 Removing syntax errors
 Phase 6: Testing
 Involves:
 Removing the logical errors
1-11
 Phase 6: Testing (Continued)
 Test data should include:
 Valid data that leads to a known result
 Invalid data
 Random data
 Actual data
 Phase 7: Refining the Solution
 More sophisticated input and output routines
 Additional features
 More error checks
1-12
 Phase 8: Production
 Involves:
 Distribution to the intended users
 Use by the users
 Phase 9: Maintenance
 Involves
 Correcting user-detected errors
 Adding more features
 Modifying existing portions to suit the users better
1-13
 A solution is good if:
 The total cost it incurs over all phases of its life cycle is
minimal
1-14
 The cost of a solution includes:
 Computer resources that the program consumes
 Difficulties encountered by users
 Consequences of a program that does not behave
correctly
 Programs must be well structured and documented
 Efficiency is one aspect of a solution’s cost
1-15
 Abstraction
 Separates the purpose of a module from its
implementation
 Specifications for each module are written before
implementation
 Functional abstraction
 Separates the purpose of a function from its implementation
1-16
 Data abstraction
 Focuses of the operations of data, not on the implementation
of the operations
 Abstract data type (ADT)
 A collection of data and operations on the data
 An ADT’s operations can be used without knowing how the
operations are implemented, if the operations’ specifications
are known
1-17
 Data structure
 A construct that can be defined within a programming
language to store a collection of data
1-18
 Information hiding
 Hide details within a module
 Ensure that no other module can tamper with these
hidden details
 Public view of a module
 Described by its specifications
 Private view of a module
 Consists of details which should not be described by the
specifications
1-19
 Principles of object-oriented programming (OOP)
 Encapsulation
 Objects combine data and operations
 Inheritance
 Classes can inherit properties from other classes
 Polymorphism
 Objects can determine appropriate operations at execution
time
1-20
 Advantages of an object-oriented approach
 Existing classes can be reused
 Program maintenance and verification are easier
1-21
 Object-oriented design (OOD)
 Produces modular solutions for problems that primarily
involve data
 Identifies objects by focusing on the nouns in the
problem statement
1-22
 Top-down design (TDD)
 Produces modular solutions for problems in which the
emphasis is on the algorithms
 Identifies actions by focusing on the verbs in the
problem statement
 A task is addressed at successively lower levels of detail
1-23
1-24
Figure 1.4
A structure chart showing the hierarchy of modules
 Use OOD and TDD together
 Use OOD for problems that primarily involve data
 Use TDD to design algorithms for an object’s
operations
1-25
 Consider TDD to design solutions to problems that
emphasize algorithms over data
 Focus on what, not how, when designing both ADTs
and algorithms
 Consider incorporating previously written software
components into your design
1-26
 The Unified Modeling Language (UML) is a modeling
language used to express object-oriented designs
 Class diagrams specify the name of the class, the data
members of the class, and the operations
1-27
 UML (Continued)
 Relationships between classes can be shown by
connecting classes with lines
 Inheritance is shown with a line and an open triangle to the
parent class
 Containment is shown with an arrow to the containing class
 UML provides notation to specify visibility, type,
parameter, and default value information
1-28
1-29
Figure 1.6
UML diagram for
a banking system
 Modularity has a favorable impact on
 Constructing programs
 Debugging programs
 Reading programs
 Modifying programs
 Eliminating redundant code
1-30
 Modifiability is possible through the use of
 Function
 Named constants
 The typedef statement
1-31
 Ease of use
 In an interactive environment, the program should
prompt the user for input in a clear manner
 A program should always echo its input
 The output should be well labeled and easy to read
1-32
 Fail-Safe Programming
 Fail-safe programs will perform reasonably no matter
how anyone uses it
 Test for invalid input data and program logic errors
 Handle errors through exception handling
1-33
 Eight issues of personal style in programming
 Extensive use of functions
 Use of private data fields
 Avoidance of global variables in functions
 Proper use of reference arguments
1-34
 Eight issues of personal style in programming
(Continued)
 Proper use of functions
 Error handling
 Readability
 Documentation
1-35
 Debugging
 Programmer must systematically check a program’s logic
to determine where an error occurs
 Tools to use while debugging:
 Watches
 Breakpoints
 cout statements
 Dump functions
1-36
 Software engineering: techniques to facilitate
development of programs
 Software life cycle consists of nine phases
 Loop invariant: property that is true before and after
each iteration of a loop
 Evaluating the quality of a solution must consideration
a variety of factors
1-37
 A combination of object-oriented and top-down
design techniques leads to a modular solution
 The final solution should be as easy to modify as
possible
 A function should be as independent as possible and
perform one well-defined task
1-38
 Functions should include a comment: purpose,
precondition, and postcondition
 A program should be as fail-safe as possible
 Effective use of available diagnostic aids is one of the
keys to debugging
 Use “dump functions” to help to examine and debug
the contents of data structures
1-39

More Related Content

What's hot

Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languagesVarun Garg
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
REHAN IJAZ
 
Chapter 13 programming languages and program development
Chapter 13   programming languages and program developmentChapter 13   programming languages and program development
Chapter 13 programming languages and program development
haider ali
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 
Characteristics of Software
Characteristics of SoftwareCharacteristics of Software
Characteristics of Software
Upekha Vandebona
 
Operating System lab
Operating System labOperating System lab
Operating System lab
Seyed Ehsan Beheshtian
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languages
Frankie Jones
 
9781285852744 ppt ch01
9781285852744 ppt ch019781285852744 ppt ch01
9781285852744 ppt ch01
Terry Yoast
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
System calls
System callsSystem calls
System calls
Bernard Senam
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
Trivuz ত্রিভুজ
 
COCOMO Model By Dr. B. J. Mohite
COCOMO Model By Dr. B. J. MohiteCOCOMO Model By Dr. B. J. Mohite
COCOMO Model By Dr. B. J. Mohite
Zeal Education Society, Pune
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming languageVasavi College of Engg
 
software engineering
software engineeringsoftware engineering
software engineering
Azad public school
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)Vaibhav Bajaj
 
Generations Of Programming Languages
Generations Of Programming LanguagesGenerations Of Programming Languages
Generations Of Programming Languages
py7rjs
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Raja Hamid
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Asfand Hassan
 

What's hot (20)

Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
 
Chapter 13 programming languages and program development
Chapter 13   programming languages and program developmentChapter 13   programming languages and program development
Chapter 13 programming languages and program development
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Characteristics of Software
Characteristics of SoftwareCharacteristics of Software
Characteristics of Software
 
Operating System lab
Operating System labOperating System lab
Operating System lab
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languages
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
9781285852744 ppt ch01
9781285852744 ppt ch019781285852744 ppt ch01
9781285852744 ppt ch01
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
Computer programming concepts
Computer programming conceptsComputer programming concepts
Computer programming concepts
 
System calls
System callsSystem calls
System calls
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
COCOMO Model By Dr. B. J. Mohite
COCOMO Model By Dr. B. J. MohiteCOCOMO Model By Dr. B. J. Mohite
COCOMO Model By Dr. B. J. Mohite
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
software engineering
software engineeringsoftware engineering
software engineering
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)
 
Generations Of Programming Languages
Generations Of Programming LanguagesGenerations Of Programming Languages
Generations Of Programming Languages
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)
 

Similar to Principles of programming

Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving TechniquesAshesh R
 
Waterfall model
Waterfall modelWaterfall model
Waterfall model
LPK Any Komputer
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering
JayaKamal
 
Programming Fundamentals lecture 3
Programming Fundamentals lecture 3Programming Fundamentals lecture 3
Programming Fundamentals lecture 3
REHAN IJAZ
 
programming and languages (chapter 14)
programming and languages (chapter 14)programming and languages (chapter 14)
programming and languages (chapter 14)
Fadilah Badari
 
SOFTWARE DEVELOPMENT AND PROCESS MODELS.pptx
SOFTWARE DEVELOPMENT AND PROCESS MODELS.pptxSOFTWARE DEVELOPMENT AND PROCESS MODELS.pptx
SOFTWARE DEVELOPMENT AND PROCESS MODELS.pptx
SanthanalakshmiSelva2
 
Software development slides
Software development slidesSoftware development slides
Software development slidesiarthur
 
Program logic and design
Program logic and designProgram logic and design
Program logic and designChaffey College
 
Slide set 1 (Traditional Software Development) (1).pptx
Slide set 1 (Traditional Software Development) (1).pptxSlide set 1 (Traditional Software Development) (1).pptx
Slide set 1 (Traditional Software Development) (1).pptx
UTKARSHBHARDWAJ71
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
vishnupriyapm4
 
Software Development
Software DevelopmentSoftware Development
Software Development
Nicole Ynne Estabillo
 
Sd Revision
Sd RevisionSd Revision
Sd Revision
mrsmackenzie
 
Machine Learning in Software Engineering
Machine Learning in Software EngineeringMachine Learning in Software Engineering
Machine Learning in Software Engineering
Alaa Hamouda
 
software engineering
software engineering software engineering
software engineering
bharati vidhyapeeth uni.-pune
 
Intro-Soft-Engg-2.pptx
Intro-Soft-Engg-2.pptxIntro-Soft-Engg-2.pptx
Intro-Soft-Engg-2.pptx
Viju Neduvathoor
 
CP7301 Software Process and Project Management notes
CP7301 Software Process and Project Management   notesCP7301 Software Process and Project Management   notes
CP7301 Software Process and Project Management notes
AAKASH S
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
shoaibkhan716300
 
Programming Theory
Programming TheoryProgramming Theory
Programming Theoryiarthur
 
software engineering
 software engineering software engineering
software engineering
Ahmed Elshahat Mohamed
 
Software Metrics - Software Engineering
Software Metrics - Software EngineeringSoftware Metrics - Software Engineering
Software Metrics - Software Engineering
Drishti Bhalla
 

Similar to Principles of programming (20)

Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Waterfall model
Waterfall modelWaterfall model
Waterfall model
 
Software Engineering
 Software Engineering  Software Engineering
Software Engineering
 
Programming Fundamentals lecture 3
Programming Fundamentals lecture 3Programming Fundamentals lecture 3
Programming Fundamentals lecture 3
 
programming and languages (chapter 14)
programming and languages (chapter 14)programming and languages (chapter 14)
programming and languages (chapter 14)
 
SOFTWARE DEVELOPMENT AND PROCESS MODELS.pptx
SOFTWARE DEVELOPMENT AND PROCESS MODELS.pptxSOFTWARE DEVELOPMENT AND PROCESS MODELS.pptx
SOFTWARE DEVELOPMENT AND PROCESS MODELS.pptx
 
Software development slides
Software development slidesSoftware development slides
Software development slides
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
Slide set 1 (Traditional Software Development) (1).pptx
Slide set 1 (Traditional Software Development) (1).pptxSlide set 1 (Traditional Software Development) (1).pptx
Slide set 1 (Traditional Software Development) (1).pptx
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
 
Software Development
Software DevelopmentSoftware Development
Software Development
 
Sd Revision
Sd RevisionSd Revision
Sd Revision
 
Machine Learning in Software Engineering
Machine Learning in Software EngineeringMachine Learning in Software Engineering
Machine Learning in Software Engineering
 
software engineering
software engineering software engineering
software engineering
 
Intro-Soft-Engg-2.pptx
Intro-Soft-Engg-2.pptxIntro-Soft-Engg-2.pptx
Intro-Soft-Engg-2.pptx
 
CP7301 Software Process and Project Management notes
CP7301 Software Process and Project Management   notesCP7301 Software Process and Project Management   notes
CP7301 Software Process and Project Management notes
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
Programming Theory
Programming TheoryProgramming Theory
Programming Theory
 
software engineering
 software engineering software engineering
software engineering
 
Software Metrics - Software Engineering
Software Metrics - Software EngineeringSoftware Metrics - Software Engineering
Software Metrics - Software Engineering
 

Recently uploaded

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 

Recently uploaded (20)

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 

Principles of programming

  • 1. Principles of Programming and Software Engineering 1-1
  • 2.  Coding without a solution design increases debugging time  A team of programmers for a large software development project involves  An overall plan  Organization  Communication  Software engineering  Provides techniques to facilitate the development of computer programs 1-2
  • 3.  Problem solving  The process of taking the statement of a problem and developing a computer program that solves that problem  A solution consists of:  Algorithms  Algorithm: a step-by-step specification of a function to solve a problem within a finite amount of time  Ways to store data 1-3
  • 4. 1-4 Figure 1.1 The life cycle of software as a waterwheel that can rotate from one phase to any other phase
  • 5.  Phase 1: Specification  Aspects of the problem which must be specified:  What is the input data?  What data is valid and what data is invalid?  Who will use the software, and what user interface should be used?  What error detection and error messages are desirable?  What assumptions are possible?  Are there special cases?  What is the form of the output?  What documentation is necessary?  What enhancements to the program are likely in the future? 1-5
  • 6.  Phase 1: Specification (Continued)  Prototype program  A program that simulates the behavior of portions of the desired software product  Phase 2: Design  Includes:  Dividing the program into modules  Specifying the purpose of each module  Specifying the data flow among modules 1-6
  • 7.  Phase 2: Design (Continued)  Modules  Self-contained units of code  Should be designed to be:  Loosely coupled  Highly cohesive  Interfaces  Communication mechanisms among modules 1-7
  • 8.  Phase 2: Design (Continued)  Specifications of a function  A contract between the function and the module that calls it  Should not commit the function to a particular way of performing its task  Include the function’s preconditions and postconditions  Phase 3: Risk Analysis  Building software entails risks  Techniques exist to identify, assess, and manage the risks of creating a software product 1-8
  • 9.  Phase 4: Verification  Formal methods can be used to prove that an algorithm is correct  Assertion  A statement about a particular condition at a certain point in an algorithm  Invariant  A condition that is always true at a particular point in an algorithm 1-9
  • 10.  Phase 4: Verification (Continued)  Loop invariant  A condition that is true before and after each execution of an algorithm’s loop  Can be used to detect errors before coding is started  The invariant for a correct loop is true:  Initially, after any initialization steps, but before the loop begins execution  Before every iteration of the loop  After every iteration of the loop  After the loop terminates 1-10
  • 11.  Phase 5: Coding (Continued)  Involves:  Translating the design into a particular programming language  Removing syntax errors  Phase 6: Testing  Involves:  Removing the logical errors 1-11
  • 12.  Phase 6: Testing (Continued)  Test data should include:  Valid data that leads to a known result  Invalid data  Random data  Actual data  Phase 7: Refining the Solution  More sophisticated input and output routines  Additional features  More error checks 1-12
  • 13.  Phase 8: Production  Involves:  Distribution to the intended users  Use by the users  Phase 9: Maintenance  Involves  Correcting user-detected errors  Adding more features  Modifying existing portions to suit the users better 1-13
  • 14.  A solution is good if:  The total cost it incurs over all phases of its life cycle is minimal 1-14
  • 15.  The cost of a solution includes:  Computer resources that the program consumes  Difficulties encountered by users  Consequences of a program that does not behave correctly  Programs must be well structured and documented  Efficiency is one aspect of a solution’s cost 1-15
  • 16.  Abstraction  Separates the purpose of a module from its implementation  Specifications for each module are written before implementation  Functional abstraction  Separates the purpose of a function from its implementation 1-16
  • 17.  Data abstraction  Focuses of the operations of data, not on the implementation of the operations  Abstract data type (ADT)  A collection of data and operations on the data  An ADT’s operations can be used without knowing how the operations are implemented, if the operations’ specifications are known 1-17
  • 18.  Data structure  A construct that can be defined within a programming language to store a collection of data 1-18
  • 19.  Information hiding  Hide details within a module  Ensure that no other module can tamper with these hidden details  Public view of a module  Described by its specifications  Private view of a module  Consists of details which should not be described by the specifications 1-19
  • 20.  Principles of object-oriented programming (OOP)  Encapsulation  Objects combine data and operations  Inheritance  Classes can inherit properties from other classes  Polymorphism  Objects can determine appropriate operations at execution time 1-20
  • 21.  Advantages of an object-oriented approach  Existing classes can be reused  Program maintenance and verification are easier 1-21
  • 22.  Object-oriented design (OOD)  Produces modular solutions for problems that primarily involve data  Identifies objects by focusing on the nouns in the problem statement 1-22
  • 23.  Top-down design (TDD)  Produces modular solutions for problems in which the emphasis is on the algorithms  Identifies actions by focusing on the verbs in the problem statement  A task is addressed at successively lower levels of detail 1-23
  • 24. 1-24 Figure 1.4 A structure chart showing the hierarchy of modules
  • 25.  Use OOD and TDD together  Use OOD for problems that primarily involve data  Use TDD to design algorithms for an object’s operations 1-25
  • 26.  Consider TDD to design solutions to problems that emphasize algorithms over data  Focus on what, not how, when designing both ADTs and algorithms  Consider incorporating previously written software components into your design 1-26
  • 27.  The Unified Modeling Language (UML) is a modeling language used to express object-oriented designs  Class diagrams specify the name of the class, the data members of the class, and the operations 1-27
  • 28.  UML (Continued)  Relationships between classes can be shown by connecting classes with lines  Inheritance is shown with a line and an open triangle to the parent class  Containment is shown with an arrow to the containing class  UML provides notation to specify visibility, type, parameter, and default value information 1-28
  • 29. 1-29 Figure 1.6 UML diagram for a banking system
  • 30.  Modularity has a favorable impact on  Constructing programs  Debugging programs  Reading programs  Modifying programs  Eliminating redundant code 1-30
  • 31.  Modifiability is possible through the use of  Function  Named constants  The typedef statement 1-31
  • 32.  Ease of use  In an interactive environment, the program should prompt the user for input in a clear manner  A program should always echo its input  The output should be well labeled and easy to read 1-32
  • 33.  Fail-Safe Programming  Fail-safe programs will perform reasonably no matter how anyone uses it  Test for invalid input data and program logic errors  Handle errors through exception handling 1-33
  • 34.  Eight issues of personal style in programming  Extensive use of functions  Use of private data fields  Avoidance of global variables in functions  Proper use of reference arguments 1-34
  • 35.  Eight issues of personal style in programming (Continued)  Proper use of functions  Error handling  Readability  Documentation 1-35
  • 36.  Debugging  Programmer must systematically check a program’s logic to determine where an error occurs  Tools to use while debugging:  Watches  Breakpoints  cout statements  Dump functions 1-36
  • 37.  Software engineering: techniques to facilitate development of programs  Software life cycle consists of nine phases  Loop invariant: property that is true before and after each iteration of a loop  Evaluating the quality of a solution must consideration a variety of factors 1-37
  • 38.  A combination of object-oriented and top-down design techniques leads to a modular solution  The final solution should be as easy to modify as possible  A function should be as independent as possible and perform one well-defined task 1-38
  • 39.  Functions should include a comment: purpose, precondition, and postcondition  A program should be as fail-safe as possible  Effective use of available diagnostic aids is one of the keys to debugging  Use “dump functions” to help to examine and debug the contents of data structures 1-39