Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
19 views

1.2 Control Structures and Object-Oriented Programming

Uploaded by

Manuel Barrera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

1.2 Control Structures and Object-Oriented Programming

Uploaded by

Manuel Barrera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

1.

Data Analysis
1.2 Control Structures and Object-Oriented Programming

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 1
1
INTRODUCTION
Hello Everyone,

In this presentation we will dive deeper into the function of a


programming language and we will see the most used control structures
to create a program.

We will also talk about what object-oriented programming is, which if


we remember presentation 1.1 is a type of classification within of
programming languages.

Remember that my door is always open in case that you


have any question.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 2
2
INTRODUCTION

One of the most important aspects of


programming is controlling which statement will
execute next. Control structures enable a
programmer to determine the order in which
program statements are executed. These control
structures allow you to do two things:

1) skip some statements while executing others

2) repeat one or more statements while some


condition is true

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 3
3
WHAT ARE PROGRAMMING CONTROL
STRUCTURES?

Programming Control Structures


refer to the way computer
instruction flow is managed.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 4
4
CONTROL STRUCTURE TYPES

Sequence: This control structure represents the linear and sequential execution of
code, where statements are executed one after another in the order they appear. This is
the simplest type of programming control structure and forms the foundation of most
programs.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 5
5
CONTROL STRUCTURE TYPES

Selection: This control structure enables a program to choose between two or more
paths of execution based on specific conditions. Selection structures include conditional
statements such as if-else and switch-case, which use Boolean expressions to evaluate
the conditions and execute the appropriate block of code.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 6
6
CONTROL STRUCTURE TYPES

Iteration: This control structure allows certain blocks of code to be executed repeatedly
as long as a condition remains true. Iteration structures include loops like the for loop,
while loop, and do-while loop.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 7
7
WHAT IS A PROGRAMING LANGUAGE?

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 8
8
REAL LIFE EXAMPLES

Sequence Control Structures:


● Reading input from devices, such as keyboards or sensors
● Performing arithmetic operations and calculations
● Printing data to a screen or file
● Calling functions to execute specific tasks

Selection Control Structures:


● Displaying different content based on user preferences
● Making logical decisions in games or simulations
● Validating input data and handling possible errors
● Controlling the flow of complex algorithms based on intermediate results

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 9
9
REAL LIFE EXAMPLES

Iteration Control Structures:


● Processing arrays or lists of data
● Running simulations and updating model parameters
● Automated testing of multiple inputs or configurations
● Generating periodic reports or log files

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 10
10
Coordinación de Tecnologías
para la Educación
Selected Topics in Information Technologies - Edgar Olivares (2024) 11
11
INTRODUCTION

In the programming world, OOP is a paradigm


that has gained widespread popularity in
recent years due to its ability to create more
robust, flexible, and maintainable
applications. This development methodology
is based on the idea that programs can be
organized as a collection of interconnected
objects, each with its own set of data and
functionality.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 12
12
INTRODUCTION

With the OOP paradigm, what is sought is to stop focusing on the pure logic of programs,
to start thinking about objects, which forms the basis of said paradigm. This helps a lot in
large systems, because instead of thinking about functions, we think about the
relationships or interactions of the different elements of the system.

Why Object Oriented Programming?

OOP allows code to be reusable, organized, and easy to maintain. And it follows the
software development principle used by many programmers DRY (Don't Repeat Yourself),
to avoid duplicating the code and create efficient programs.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 13
13
WHAT IS OOP?

Object Oriented Programming (OOP) is a


programming paradigm, that is, a programming model
or style that gives us guidelines on how to work with
it. It is based on the concept of classes and objects.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 14
14
OOP Structure

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 15
15
WHAT IS THE STRUCTURE OF OBJECT-
ORIENTED PROGRAMMING?
Classes are user-defined data types that act as the blueprint for individual objects,
attributes and methods.

Objects are instances of a class created with specifically defined data. Objects can
correspond to real-world objects or an abstract entity. When class is defined initially,
the description is the only object that is defined.

Methods are functions that are defined inside a class that describe the behaviors of
an object. Each method contained in class definitions starts with a reference to an
instance object. Additionally, the subroutines contained in an object are called
instance methods. Programmers use methods for reusability or keeping functionality
encapsulated inside one object at a time.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 16
16
WHAT IS THE STRUCTURE OF OBJECT-
ORIENTED PROGRAMMING?
Attributes are defined in the class template and represent the state of an object.
Objects will have data stored in the attributes field. Class attributes belong to the
class itself.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 17
17
WHAT IS A PROGRAMING LANGUAGE?

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 18
18
OOP Principles

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 19
19
PRINCIPLES OF OBJECT ORIENTED
PROGRAMMING

Encapsulation

Encapsulation presents all the important information of an object within the object and
only exposes the chosen information to the outside world.

This property ensures that the information of an object is hidden from the outside
world, grouping in a class the characteristics or attributes that have private access, and
the behaviors or methods that have public access.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 20
20
PRINCIPLES OF OBJECT ORIENTED
PROGRAMMING

Abstraction

Another of the principles of Object-Oriented Programming is abstraction, which occurs


when the user interacts only with the selected attributes and methods of an object,
using simplified high-level tools to access a complex object.

In OOP, programs are usually very large and objects communicate a lot with each other.
In this way, abstraction makes it easier to maintain large code, where different changes
may arise over time.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 21
21
PRINCIPLES OF OBJECT ORIENTED
PROGRAMMING

Heritage

Inheritance defines hierarchical relationships between classes, so that common


attributes and methods can be reused. Parent classes extend attributes and behaviors to
child classes. By defining basic attributes and behaviors in a class, child classes can be
created, extending the functionality of the parent class and adding extra attributes and
behaviors. It is one of the keys to Object Oriented Programming.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 22
22
PRINCIPLES OF OBJECT ORIENTED
PROGRAMMING

Polymorphism

Polymorphism lies in designing objects to share behaviors, which allows objects to be


processed in different ways. It is the ability to present the same interface for different
underlying forms or data types. Using inheritance, objects can override shared parent
behaviors, with specific child behaviors. Polymorphism allows the same method to
execute different behaviors in two ways: method overriding and method overloading.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 23
23
PRINCIPLES OF OBJECT ORIENTED
PROGRAMMING

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 24
24
BENEFITS OF OBJECT ORIENTED
PROGRAMMING
● Code reuse.
● Converts complex things into simple
reproducible structures.
● Avoid code duplication.
● Allows teamwork thanks to encapsulation.
● Since the class is well structured, it allows
errors to be corrected in various places in the
code.
● Abstraction allows us to build more complex
systems in a simpler and more organized way.

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 25
25
OOP PROGRAM LANGUAGES EXAMPLES
Java is widely used in the development of enterprise applications, embedded systems, mobile
applications (Android) and in academia.

C++ It is used in a wide variety of applications, including game development, operating


systems, high-performance applications or embedded software, among others.

Python is known for its readability and simplicity, making it suitable for rapid prototyping, web
development (with frameworks like Django and Flask), task automation, data analysis, and data
science.

PHP is widely used for web development. It is mainly used in creating dynamic websites and
applications.
Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 26
26
QUESTION?
Why OOP and Control Structures are important for
programing development?

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 27
27
CONCLUSION
In conclusion we can see that there is a lot to think about before starting a
programming development. Nowadays programs are very complex and with
thousands or millions of lines of programming, and being structured helps us to
make our lives easier, to avoid spending hours looking for any errors in the program
and to avoid spending a lot of resources (repeating code for example). In this
presentation we saw the most used ways today to organize our code when speaking
about programing paradigms and control structures

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 28
28
BIBLIOGRAPHY CONSULTED
Study Smarter, (-) Programming Control Structures
https://www.studysmarter.co.uk/explanations/computer-science/computer-programming/programming-control-structures/

Unir, (Sep, 2023) ¿Qué es la programación orientada a objetos?


https://unirfp.unir.net/revista/ingenieria-y-tecnologia/programacion-orientada-objetos/

Jorge Vasconcelos, (-) Programming (Control) Structures Guide


https://www.cs.jhu.edu/~cs333/ProgrammingStructures.pdf

Sergio Darias, (Nov, 2021) Qué es la Programación Orientada a Objetos


https://intelequia.com/es/blog/post/qu%C3%A9-es-la-programaci%C3%B3n-orientada-a-objetos

Miriam Martínez Canelo, (Nov, 2020) ¿QUÉ ES LA PROGRAMACIÓN ORIENTADA A OBJETOS?


https://profile.es/blog/que-es-la-programacion-orientada-a-objetos/

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 29
29
Todos los recursos educativos abiertos, elaborados por la Universidad
Anáhuac México y su equipo de docentes, se proveen bajo la licencia
Creative Commons Reconocimiento -NoComercial- SinObraDerivada CC
BY-NC-ND. http://creativecommons.org/licenses/by-nc-nd/4.0/

Coordinación de Tecnologías
para la Educación
Contemporary Developments - Edgar Olivares (2024) 30
30

You might also like