Programming Paradigms
- models for best practices to manage more complex code and decrease development time.
- We will focus on procedural programming, which centers on the concept of procedures and functions.
- allow us to isolate different subtasks within a program and deal with each individually. And later, if we think of a better way to solve a problem, or if we detect an error in the logic, there’s only one place that we need to make changes.
- When we modify a function, all the programs that use the function will incorporate the changes the next time they’re called, because the updated function will be imported by any program that calls it.
What is a Programming Paradigm?
- A model for programing
- uses specific collection of conccepts and practices for
- approaching a problem
- implementation fo techniques
- structuring a solution
to improve
- code clarity
- code quality
- reduce developing time
- and manage complexity
You can use one or multiple paradigms in your program
Types of Programming Paradigms
* Imperative Programming
* structured Programming
* Procedural Programming
* Procedures
* Object Oriented
Imperative Programming
Has statements
- entered in a specific order
- that are executed step by step
Structured Programming
- has all Imperative Programming features
- Uses of control tructure (if, for, while)
- Uses iteration to solve problems
Procedural Programming
- has all Structured Programming features
- Groups related pieces of code into modules or functions (modularity)
- Divides complex task into smaller tasks
- that leads to - Makes code more reusable and flexible
Procedures
The buidling blocks of modularity are procedures.
- are codeblocks with names
- Are initiated by procedure calls
- their execution is initiated by a procedure call.
Examples
- Sort a list
- Delete unused files
- clip the first 10 seconds of a video
- print a pdf file
- retrieve stock prize for today’s biggest mover.
Procedures and functions can also accepts values as input.
Arguments
- Values (inputs) passed to a procedure or a function
- allow more flexibility and versatile
Arguments Examples
- diretion of a sort (either ascending or descending)
- clip seconds
- pages (range and number of copies)
- copies