0% found this document useful (0 votes)
10 views23 pages

Week 14

Uploaded by

khutsishvilin11
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)
10 views23 pages

Week 14

Uploaded by

khutsishvilin11
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/ 23

OBJECT ORIENTED PROGRAMMING

International Black Sea University


Faculty of Business and Technology

Lecturer: Nika Narushvili


14TH WEEK
TOPICS

• Summary of the OOP course


• Some programming facts
• Exercises
CORE PRINCIPLES OF OOP

• Encapsulation – bundling fields and methods into a single unit (class)


• Inheritance – establishing a relationship between a base class (parent) and a derived
class (child), where the child inherits properties and behaviors of the parent
• Polymorphism – ability of different objects to respond to the same message (method
call) in different ways, includes method overloading and method overriding
• Abstraction – hiding complex implementation details and showing only essential
features of an object
ENCAPSULATION

Car is a class grouping


two fields: brand and
year, this way all the
info related to a Car is
encapsulated within the
class
INHERITANCE

The Dog class shares all


properties of its base
class Animal, meaning
that it can both “eat” and
“bark”
POLYMORPHISM

Even though the `callDraw` accepts a `Shape` object, if we


pass in a Circle and Rectangle then respective messages
will be printed.
ABSTRACTION

To achieve abstraction, we can


create classes with pure virtual
functions, such classes can’t
be instantiated – meaning that
you can’t create objects from
them, their only purpose is to
have some common functions
or fields and have other
classes inherit them
OOP BENEFITS

• Modularity: encapsulation allows for independent development and


maintenance of components
• Reusability: inheritance enables code reuse, reducing redundancy
• Extensibility: easily add new features by extending existing classes
• Abstraction: simplifies complex systems by modeling classes appropriate to
the problem
SOME FACT

Let’s explore some fun facts connected with the world of programming
ORIGIN OF THE TERM “BUG”

The term "bug" to describe a software glitch dates back to 1947. Engineers
found an actual moth causing issues in the Mark II computer at Harvard
University. The moth was removed and taped into the logbook with the note:
"First actual case of bug being found."
HELLO, WORLD!

The first program most people write when learning a new programming
language is "Hello, World!" This tradition started with the book "The C
Programming Language" by Brian Kernighan and Dennis Ritchie.
FIRST HIGH-LEVEL PROGRAMMING
LANGUAGE:

Fortran (short for "Formula


Translation") is considered one of
the first high-level programming
languages. It was created in the
1950s and is still in use today,
especially in scientific computing.
SPACE AND CODING

NASA’s Apollo missions, which successfully landed humans on the


moon, relied heavily on code. Margaret Hamilton led the team that
developed the onboard flight software for the Apollo missions.
The onboard flight software for the Apollo missions, known as the
Apollo Guidance Computer (AGC) software, consisted of
approximately 145,000 lines of code. This code was written in
Assembly language and stored on physical memory modules called
"core rope memory." Each bit of data was literally woven into the
memory, and it took weeks for technicians to create each module by
hand.
A copy of the code files used in the space mission is available on GitHub
https://github.com/chrislgarry/Apollo-11
THE FIRST COMPUTER GAME

The first known


computer game is
"Spacewar!", created
in 1962 by Steve
Russell at MIT. It was
designed to be played
on the PDP-1, a
minicomputer.
PYTHON'S NAME

Python, a popular programming language, is named after the British comedy


series "Monty Python's Flying Circus," not the snake.
OPEN SOURCE

Linux, one of the most widely used operating systems, is open-source and free.
It powers most of the world's web servers, supercomputers, and cloud
infrastructures.
THE LONGEST PROGRAMMABLE NUMBER

The largest number a typical computer can handle is 2^64-1, which is


18,446,744,073,709,551,615. It’s known as the maximum value for a 64-bit
unsigned integer.
EXERCISE 1: TURTLE IN THE WELL

A turtle is stuck at the bottom of the well, the height of the well is H.
Each day, the turtle goes up by X meters, but at night the turtle falls asleep and
slides down by Y meters.
H, X and Y are inputs to your program.

Write a program which will accept these inputs and output how many days it
will take the turtle to get out of the well.
EXERCISE 2: ANAGRAM CHECKER

Write a function that takes two strings and returns true if they are anagrams of
each other, and false otherwise. Anagrams are words or phrases made by
rearranging the letters of another, such as "cinema" and "iceman".

Take 2 strings as an input, output `true` or `false` depending on whether the


strings are anagrams.
EXERCISE 3: CALENDAR SCHEDULER

Create a simple calendar scheduler. Implement a class that allows users to add
events, remove events, and view the schedule for a given day. Each event has a
start time, end time, and description.
Here you can be creative as there are no strict requirements: just design the
program as you wish, some hints: allow the user to interact with the calendar,
e.g. in the console ask for input and decide what to do based on the input.
NEXT STEPS FOR YOU….

Having finished the OOP course, you now have better understanding about programming
fundamentals and have practiced quite a lot, but this is just the beginning. Some advices for the next
steps:
• Practice – best way to solidify your programming skills is through practice, work on small
projects and solve problems on popular coding challenge platforms such as hackerrank, leetcode,
codeforces, etc.
• Explore different programming languages: try Java, Python, C#, you will quickly realize that the
concepts of programming are the same in every language, it’s just the style and syntax that is
different
• Build a portfolio – create a GitHub account, push some code there, create projects by yourself or
collaborate with your friends
GOOD LUCK!

You might also like