University American College Skopje Fundamentals of Programming Course Outline PDF
Document Details
University American College Skopje
Tags
Summary
This is a course outline for a Fundamentals of Programming course at University American College Skopje. It covers course goals, specific topics, required literature, class format, and grading. The document also includes various study tips and advice for students.
Full Transcript
University American College Skopje School of Computer Science and Information Technology Course: Fundamentals of Programming Introduction to the Course Course Outline 27/09/2023 1 ...
University American College Skopje School of Computer Science and Information Technology Course: Fundamentals of Programming Introduction to the Course Course Outline 27/09/2023 1 Course Goals To give students a foundation in computer programming. To teach the basics of programming in the C++ programming language. To present students with the concepts and approach to programming. To introduce students to practical algorithmic thinking. Course Goals – Specifics Specifically, the course will cover the following topics: – Introduction to computers and programming; – Introduction to C++ programming; – Control statements; – Logical operators; – Pointers; – Arrays; – Strings; – Functions; – Structures. Literature Harvey M. Deitel, Paul J. Deitel C++ How to Program, 10th Edition, 2016 Pub: Pearson Class Format 2+2 ̶ 2 for lectures; ̶ 2 for lab work. Common class delivery: ̶ Lecture; ̶ Quiz at the end of the lecture; ̶ Homework; ̶ Lab work. Groups for Lab Work There will be two groups of students for the lectures and two groups of students for the laboratory exercises. Each group will have its classes starting on Wednesday and Thursday, depending on the group. ̶ The distribution of students per group should be announced to you already. Study Materials The presentations given at the classes are the primary sources of study materials. The quizzes given at the end of each class are conducted via the Moodle portal. ̶ Thus, they are graded immediately. ̶ The students may view the answers at any time, thus giving them additional study materials. Often, exam questions are given from the quizzes. If the students can access other materials on the Internet or in the library, they are encouraged to use them. Grading Attendance – 10% ̶ An attendance list is kept for each class. Quizzes – 10% ̶ Given at the end of the class. Homework – 20% ̶ Homework is given with a deadline 5% ̶ Assignment given at the end of the lab class 15% Mid-term exam – 30% Final Exam – 30% ̶ Both exams contain True/False questions, multiple choice questions and theoretical assignments in the theoretical part, and programming assignments in the practical part. Normalizing The student that scores the best result on an exam or a quiz will be given a bonus. Students that have interim results will obtain a partial bonus, depending on the difference between the best and the worst result. ̶ All results will be normalized. Bonuses depend on the type of assessment. Quiz Bonus In quizzes, the students that obtain the best result will obtain 100% of the total quiz points. ̶ There is only one correct answer per quiz question. All other students will be normalized linearly according to the result of the best student. Example: ̶ The best result from the quizzes is 80%. ̶ The best result is multiplied by 1.25 (=100/80), so that it would become 100%. ̶ All other results are multiplied also by 1.25 and proportionally increased. Exam Bonus The best student will earn additional bonus points. All other results will be linearly normalized. The bonus is given ONLY if the best result on the exam earns a passing grade. ̶ i.e., is 60 points or more. Useful Tips Carry paper and pen/pencil with you at all times! ̶ This is a general life tip. You never know when you will need it. ̶ Computer Science is best learned when schematics are drawn about the structure of the program and its goals. It promotes visualization of the programming process. Useful Tips When you come back home, review the entire material taught for that day. ̶ Including the theoretical part and the quiz questions. ̶ Computer Science is best learned when schematics are drawn about the structure of the program and its goals. It promotes visualization of the programming process. Retype the code from all of the assignments! Don’t copy-paste! ̶ Even if you simply retype the entire assignment, you will gain motor skills. This is so-called “Body memory”. Tweak the assignment at home. ̶ Deliberately make an error and see what you will get as a result. Don’t just notice how the program works – understand why it works and why it may not work. Useful Tips Do your homework! ̶ Statistically, students who had done their homework always obtained better grades. Because they were given credit for their homework. Because they gained a more in-depth knowledge of the material and performed better on the exams. Experiment! ̶ E.g., if the given problem is to find the sum of two numbers (and a solution is given for it). What if the problem were to find their difference/product/quotient…? What if there were three/four/five/… numbers? Useful Tips Practice (pro)actively! ̶ The more assignments you complete, the better you get. Especially true in programming. ̶ Find assignments beyond just the ones you received in class. Find assignments on the Internet. Ask friends who are programmers to give you some assignments to solve. Contact Lecturers: Ivan Petrov, PhD [email protected] Assistants: Monika Arsenovska, MSc [email protected] Matej Gjozinski [email protected] Demonstrator Dimitar Anakiev [email protected] Office hours: – Will be published subsequently. University American College Skopje School of Computer Science and Information Technology Course: Fundamentals of Programming Introduction to Computers and C++ Lecture 04/10/2023 17 Lesson Contents Recent developments in the computer area; Concepts of computer hardware and software; The different types of programming languages; A typical C++ programming environment; Issues when programming; Information about the C++ standards. Introduction C++ is a computer programming language appropriate for both people with little or no programming experience and experienced programmers. It can be used for creating both introductory programs and complex information systems. Programming language = a language by which instructions are written to instruct the computer to perform certain tasks. Software (the instructions written) controls the hardware (the physical computer). – It is the hardware that does the work. – It is the software that tells the hardware how to do the work. Introduction C++ is an object-oriented language. – Object-oriented programming is the key programming technology in today’s world. C++ is one of the most popular software development languages. C++14 and C++17 are the latest versions standardized through the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC). – https://www.iso.org/ – http://www.iec.ch/ Hardware and Software Computers can perform calculations and make logical decisions much faster than human beings can. Today’s personal computers can perform billions of calculations in one second. – More than a human can perform in a lifetime. Supercomputers can perform thousands of trillions (i.e., quadrillions) of instructions per second. Hardware and Software This power of the computers is harnessed by people through the use of computer programs. These programs guide the computer through ordered actions specified by people called computer programmers. The programs that run on a computer are referred to as software. The most widely used programming methodology today is object-oriented programming. – It enhances programmers’ productivity, thereby reducing software-development costs. Hardware Development A computer consists of various devices known commonly as hardware. – Keyboard, mouse, screen, hard disks, memory, DVD drives, processing units, printer,… Rapid development in hardware and software technologies makes computing costs drop dramatically. – In the early days, computers filled entire rooms, heated up tremendously and spent a lot of electrical energy. – Today, such calculations can be performed on chips that are smaller than a fingernail, which spend very little energy and cost a few dollars. Silicon-chip technology has made computing so economical that computers have become commodity. Moore’s Law The trend of computer hardware prices declining has been observed by Gordon Moore (co-founder of Intel), who postulated what is known as Moore’s Law. It states that every two years the number of chips on an integrated circuit doubles, while prices remain the same. Specifically, what doubles is: – The amount of memory that computers have for programs; – The amount of secondary storage they have to hold programs and data over longer period of time; – The processor speeds. This is due to increased competition in the hardware- producing companies, which leads to lower prices of the hardware. Moore’s Law Similar growth can be seen in the communications technology. – The demand for more bandwidth has also sparked competition among the communication service providers. – The increased demand produced increased supply, which ultimately lowers the costs. Today, no other field is known in which technology develops so quickly and costs fall so rapidly. That is why computer technology is the most sought-after technology today. Types of Computer Languages by the Level of Abstraction The development of computer technology has fostered a development in programming languages as well. A lot of programming languages have been created and are still being created today. They can be grouped based on several features. When grouping programming languages by the level of abstraction, they are grouped based on the amount of features they have depending on the hardware configuration they run on. Thus, there are three general types: – Machine languages; – Assembly languages; – High-level languages. Types of Computer Languages by the Level of Abstraction Machine languages. – Any computer can directly understand only its own machine language (also called machine code), defined by its hardware architecture. – Machine languages generally consist of numbers (ultimately reduced to 1s and 0s). – Such languages are cumbersome for humans. Types of Computer Languages by the Level of Abstraction Assembly Languages. – English-like abbreviations to represent elementary operations. These abbreviations represent instructions in machine code. – These abbreviations formed the basis of assembly languages. – Translator programs called assemblers were developed to convert early assembly-language programs to machine language. Types of Computer Languages by the Level of Abstraction High-Level Languages – To speed up the programming process further, high-level languages were developed in which single statements could be written to accomplish substantial tasks. – Translator programs called compilers convert high- level language programs into machine language. – They allow for writing instructions that look more like everyday English and contain commonly used mathematical expressions. Types of Computer Languages by Translation The key to successful execution of a program is its translation from high-level to machine level. Commonly this is done through the use of compilers. – The entire source code of the language is translated into machine language at once. – This produces an executable file, which can be run at any time. Types of Computer Languages by Translation Interpreters execute high-level languages directly, without generating an executable file. Interpreters are generally slower to execute than compilers. – The translation is done line-by-line. – The executable file is optimized for execution on the machine it was built on. However, interpreters have advantages over compilers when it comes to processing on the Internet. C and C++ C was implemented in 1972 by Dennis Ritchie at Bell Laboratories. Initially became widely known as the UNIX operating system’s development language. – Today, most of the code for general-purpose operating systems is written in C or C++. C++ evolved from C, which is available for most computers and is hardware independent. C and C++ The widespread use of C with various kinds of computers (sometimes called hardware platforms) led to many variations. American National Standards Institute (ANSI) cooperated with the International Organization for Standardization (ISO) to standardize C worldwide. – Later, the International Electrotechnical Commission (IEC) joined the project. A joint standard document was published in C and C++ C++, an extension of C, was developed by Bjarne Stroustrup in 1979 at Bell Laboratories. C++ provides a number of features that “spruce up” the C language. C++ also provides capabilities for object- oriented programming that were inspired by the Simula simulation programming language. C and C++ C++ Standard Library. – C++ programs consist of pieces called classes and functions. – Most C++ programmers take advantage of the rich collections of classes and functions in the C++ Standard Library. – Two parts to learning the C++ “world”: The C++ language itself (the core language); How to use the classes and functions in the C++ Standard Library. – Many special-purpose class libraries are supplied by independent software vendors. A Typical C++ Development Environment C++ systems generally consist of three parts: – A program development environment; – The C++ language; – The C++ Standard Library. C++ programs typically go through six phases: – Edit; – Preprocess; – Compile; – Link; – Load; – Execute. A Typical C++ Development Environment Phase 1 consists of editing a file with an editor program, normally known simply as an editor. – Type a C++ program (source code) using the editor. – Make any necessary corrections. – Save the program. – C++ source code filenames often end with the.cpp,.cxx,.cc or.C extensions, which indicate that a file contains C++ source code A Typical C++ Development Environment A Typical C++ Development Environment Linux editors: vi and emacs. A simple text editor, such as Notepad in Windows, can also be used to write C++ code. Integrated development environments (IDEs). – Provide tools that support the software- development process, including editors for writing and editing programs and debuggers for locating logic errors—errors that cause programs to execute incorrectly. A Typical C++ Development Environment Popular IDEs: – Microsoft® Visual Studio 2015 Community Edition; – NetBeans; – Eclipse; – Apple’s Xcode; – CodeLite; – Clion; – CodeBlocks; –... A Typical C++ Development Environment In phase 2, the command to compile the program is given. – A preprocessor program executes automatically before the compiler’s translation phase begins. Phase 2 is therefore called preprocessing. Phase 3 is called compiling. – The C++ preprocessor obeys commands called preprocessing directives, which indicate that certain manipulations are to be performed on the program before compilation. – These manipulations usually include (copy into the program file) other text files to be compiled, and perform various text replacements. A Typical C++ Development Environment A Typical C++ Development Environment In Phase 3, the compiler translates the C++ program into machine-language code—also referred to as object code. A Typical C++ Development Environment A Typical C++ Development Environment Phase 4 is called linking. – The object code produced by the C++ compiler typically contains “holes” due to these missing parts. – A linker links the object code with the code for the missing functions to produce an executable program. – If the program compiles and links correctly, an executable image is produced. A Typical C++ Development Environment A Typical C++ Development Environment Phase 5 is called loading. – Before a program can be executed, it must first be placed in the operative (primary) memory. The primary memory is sometimes called Random-Access- Memory or RAM. – The name is misleading, but remained for historical reasons. The storage memory of the computer is called secondary memory. – Represented by hard disk drives (HDDs), CDs, DVDs etc. – This is done by the loader, which takes the executable image from disk and transfers it to memory. – Additional components from shared libraries that support the program are also loaded. A Typical C++ Development Environment A Typical C++ Development Environment Phase 6: Execution. – Finally, the computer, under the control of its CPU, executes the program one instruction at a time. – Some modern computer architectures often execute several instructions in parallel. A Typical C++ Development Environment Issues that May Arise during Programming Programs may not work on the first try. There might be errors that prevent the program from converting to executable form (i.e., compilation errors) – Syntax errors; – Language errors; – Operation errors; – … In such a case, the source code needs to be fixed, so that the program would be brought to a state which can be successfully compiled. Issues that May Arise during Programming Most C++ programs input and output data. When the program compiles correctly, but produces incorrect results when provided with certain data, then the program exhibits runtime errors. – These errors can be detected only when testing the program. – Some errors may cause the program to stop executing (i.e., crash) – These errors also need to be fixed in the source code. Programs that perform their tasks without crashing, no matter what data are input into them, are called robust programs. Issues that May Arise during Programming Finally, a program may compile correctly, may not crash when given various data, but may still produce incorrect or unwanted results. In such a case, there is one or more logical errors in the program. They are often a result of the wrong approach towards the solution of the problem. They also need to be fixed in the source code. – Even though finding them may not be straightforward. Debugging Programming errors are known colloquially as bugs. The process of fixing programming errors is called debugging. The most primitive method of debugging is to display messages about the program or its state on every important point. – This is an effective technique even today. The IDEs usually offer tools for debugging in which the source code and results from its execution are displayed side by side. – So the state of the program can be tracked closely and bugs can be discovered every time they appear. The Evolution of C++ C++11 (formerly called C++0x) was published by ISO/IEC in 2011. The main goals were to – Make C++ easier to learn; – Improve library building capabilities; – Increase compatibility with the C programming language. This version of the standard extended the C++ Standard Library and includes several features and enhancements to improve performance and security. The Evolution of C++ The C++14 standard was published by ISO/IEC in 2014. – Added several language features and C++ Standard Library enhancements, and fixed bugs from C++11. The next version of the C++ standard, C++17, has been published by ISO/IEC in in December 2017. The following version of the C++ standard is called C++20 and is currently being revised. For a list of C++ version features and the compilers that support them, visit – http://en.cppreference.com/w/cpp/compiler_support The Boost C++ Libraries The Boost C++ Libraries are free, open-source libraries created by members of the C++ community. Boost has grown to over 100 libraries, with more being added regularly. The goal of this project is to enrich the C++ programming community with user-friendly libraries and thus improve C++ programming overall. Some of the libraries have been included in the C++11 standard. http://www.boost.org/