Modern Introduction to Object Oriented Programming for Prospective Developers
()
About this ebook
Related to Modern Introduction to Object Oriented Programming for Prospective Developers
Related ebooks
Essential Algorithms: A Practical Approach to Computer Algorithms Rating: 5 out of 5 stars5/5Algorithm Challenges: The Dojo Collection Rating: 0 out of 5 stars0 ratingsC Programmin Language Rating: 0 out of 5 stars0 ratingsHeterogeneous Computing with OpenCL 2.0 Rating: 0 out of 5 stars0 ratingsWriting Compilers and Interpreters: A Software Engineering Approach Rating: 3 out of 5 stars3/5Embedded Computing: A VLIW Approach to Architecture, Compilers and Tools Rating: 0 out of 5 stars0 ratingsMastering C++ Network Automation Rating: 0 out of 5 stars0 ratingsLearning Cython Programming - Second Edition Rating: 0 out of 5 stars0 ratingsHigh Performance Parallelism Pearls Volume One: Multicore and Many-core Programming Approaches Rating: 0 out of 5 stars0 ratingsReal-Time Embedded Systems Rating: 0 out of 5 stars0 ratingsDigital Computer Structure and Design Rating: 0 out of 5 stars0 ratingsTensorFlow A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsSystems Programming: Designing and Developing Distributed Applications Rating: 0 out of 5 stars0 ratingsOpenVX Programming Guide Rating: 0 out of 5 stars0 ratingsDistributed Computer Systems: Theory and Practice Rating: 4 out of 5 stars4/5Engineering a Compiler Rating: 0 out of 5 stars0 ratingsDigital Filters and Signal Processing in Electronic Engineering: Theory, Applications, Architecture, Code Rating: 0 out of 5 stars0 ratingsImplementing 802.11 with Microcontrollers: Wireless Networking for Embedded Systems Designers Rating: 0 out of 5 stars0 ratingsResource Efficient LDPC Decoders: From Algorithms to Hardware Architectures Rating: 0 out of 5 stars0 ratingsBeginning Linux Programming Rating: 0 out of 5 stars0 ratingsOpenFlow Cookbook Rating: 5 out of 5 stars5/5Approximate Dynamic Programming: Solving the Curses of Dimensionality Rating: 4 out of 5 stars4/5Linux Kernel Development A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsIntroduction to Parallel Programming Rating: 0 out of 5 stars0 ratingsHeterogeneous System Architecture: A New Compute Platform Infrastructure Rating: 0 out of 5 stars0 ratingsKalman Filters: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsEmbedded RTOS Design: Insights and Implementation Rating: 0 out of 5 stars0 ratingsDiscrete Cosine Transform: Algorithms, Advantages, Applications Rating: 0 out of 5 stars0 ratings
Computers For You
Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratingsElon Musk Rating: 4 out of 5 stars4/5The Mega Box: The Ultimate Guide to the Best Free Resources on the Internet Rating: 4 out of 5 stars4/5ChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsThe ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 0 out of 5 stars0 ratingsThe Best Hacking Tricks for Beginners Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Practical Lock Picking: A Physical Penetration Tester's Training Guide Rating: 5 out of 5 stars5/5People Skills for Analytical Thinkers Rating: 5 out of 5 stars5/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5CompTIA Security+ Practice Questions Rating: 2 out of 5 stars2/5The Designer's Web Handbook: What You Need to Know to Create for the Web Rating: 0 out of 5 stars0 ratingsLearning the Chess Openings Rating: 5 out of 5 stars5/5The Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Web Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsRemote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5Ultimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5
Reviews for Modern Introduction to Object Oriented Programming for Prospective Developers
0 ratings0 reviews
Book preview
Modern Introduction to Object Oriented Programming for Prospective Developers - Fabian Gebert
Epilogue
1 Introduction to the Theoretical Background
Software basically transforms data. Functions compute calculations and store the results into the memory. Various hardware items such as the keyboard or the mouse generate a huge amount of data that needs to be processed. Output devices like screens and printers allow to react to the user input.
In this section, we introduce and discuss important ideas involved with object oriented programming.
Learning Goals After reading this section, you will be able to:
– Describe the way the computer saves information
– Explain what functions and variables are
– Discuss the advantages of programming with classes
– Describe the way the execution of programme code works
1.1 Memory
One of the most basic things about a computer is its memory. It contains the data necessary to display a picture on the screen, to print out something or to send an email. At a higher level of abstraction, the memory is just an array¹ of bits. A bit is 1 sequence or ordered set that is the smallest memory unit in the computer and has the states 0 and 1. All data is being represented by bits, usually in packets of eight bits, that is one byte. When we want to represent a decimal number, e.g. n = 120 we can decompose that number into powers of 2:
e9781447610342_i001.jpgThis number will usually be represented ² by eight bits with the states 0, 1, 1, 1, 1, 0, 0, 0.
Instead of numbering the bits, we group the memory into bytes and number them. We simply start at 0 and count up till the end of the available memory. To access data, we just need the number of the starting byte in memory and the number of bytes we want to read. On a x86-computer (ordinary desktop computer), the common integer number consists of 32 bits and therefore refers to an integer between 0 and 2³² − 1. If we need negative numbers, we just³ interpret the number as its ordinary value minus 2³¹ . The range of the variable then is [2³¹; 2³¹ − 1].
Exercise 1.1: Ways of saving strings in memory⁴ A string is an array of characters. Sentences, phrases and single letters can be represented by strings. What would be the most memory saving way to represent a string in memory allowing to determine the length of it? What do we have to consider when we have a large string with several parts we want to access quickly?
1.2 Execution
Basically, the processor starts reading the memory at a particular position and executes commands according to the data it is provided with⁵. One very basic command understood by the processor is moving parts of the memory into the processor’s register⁶ and vice versa. Different commands then allow to perform operations with the data in the register. For instance addition or multiplication of numbers. The data can be written back into the main memory afterwards. When a command is executed, the processor jumps to the next order and so on. It is also possible to jump within the command list using the go to command⁷.
1.3 Functions
When the tasks are getting more complex than simple calculations, we should work with the computer in a more abstract way. It is not usual to programme the computer using punch cards or assembly language any longer, the computer nowadays understands a more human language. This is the step where source code and compiler⁸ appear. The code is a listing of human readable language statements structured in specific parts. The compiler translates the source into the language the processor understands, i.e. sequences of machine code commands.
We structure the code in functions. That makes it easier to read the code and allows to reuse specific parts of the code at other places in the code by referring to the function. We can simply call a function which then performs a calculation and returns a result which can be used at the position of the function call. The code execution begins at the main function from which all operations are performed. When having done all operations, the execution reaches the end of the main function and stops⁹.
Similar to the mathematical definition, a function maps from one set of variables into another. In computing, a function usually takes zero, one or multiple arguments of different kinds and returns a result. We could for example define the function sine, which takes the argument angle and returns the sine value corresponding to the angle, whereas angle and the return value are just numbers.
Even though at the end of the day, the computer speaks a language consisting of numbers, using modern programming languages we use variable types that match the idea of what they naturally refer to. For instance, when we are calculating a birthday, we can use the variable type date. If we want to listen to a audio file, we could pass the play function a string describing the resource where it is to find the music file using an URL or file path. Also we might define a function that directly takes the data as an array of bytes¹⁰.
When we call a function, the runtime has to find the way back to the caller when the function returns. Therefore, the runtime provides a call stack. As soon as a function is called, it adds the code line¹¹ of the caller. When the called function returns, the runtime can find the way back to the caller by popping the last added address from the stack. Also, the stack is commonly used to store