Course Introduction
-
Time: 51 hours
-
College Credit Recommended
-
Free Certificate
First, read the course syllabus. Then, enroll in the course by clicking "Enroll me in this course". Click Unit 1 to read its introduction and learning outcomes. You will then see the learning materials and instructions on how to use them.
-
Unit 1: The Building Blocks of Object-Oriented Programming
Being familiar with both C++ and Java, you are ready to explore more advanced topics in Object-Oriented (OO) Programming. We will begin by discussing the motivation behind programming with objects, learning the essential characteristics of OO Programming languages and identifying the advantages and disadvantages of various major programming frameworks. The unit will also provide a general history of OO Programming and review major characteristics of OO Programming. By the end of this unit, you will be able to discuss different programming paradigms and identify the main properties of OO Programming.
Completing this unit should take you approximately 12 hours.Unit 2: C++ and Java Differences
To understand a language, it helps to know what motivated its development, its principle concepts (which we call its "programming paradigm"), and how it relates to other languages. If you have completed CS101: Introduction to Computer Science I and the first unit of this course, you should have a strong grasp of Java and C++, their uses, and a basic understanding of object-oriented programming. In this unit, we will outline the similarities and differences between these two languages, noting how each is used in the industry. We will also take an in-depth look at the basic building blocks of each language in order to draw a distinction between the two and further acquaint you with both languages. While there are many syntactual similarities between Java and C++, they are not necessarily translated one to another easily. As you study, pay close attention to the distinctions between the two.
Completing this unit should take you approximately 6 hours.- Upon successful completion of this unit, you will be able to:
- discuss Java and C++ within the context of object-oriented computer programming languages;
- describe how C++ and Java are used in industry;
- compare and contrast features of Java and C++, such as variable representation and memory management, to show how the languages are similar but use different syntax; and
- relate generic programming to template and container programming.
2.1: C++ Background
The C programming language is the procedural/modular precursor to C++, which adds object-orientation. Read this history of C to see where the C fits into the 'larger picture' of computing history. The history of C is part of the lore of programming, Unix/Linux, and the Internet, which everyone who studies programming should know.
This page discusses the development relationship of C and C++.
This article provides an overview of the elements of C++; specifically, the 'C' portion of C++.
Note how section 2.2 describes tokens as the "minimal chunks of a program". The root goal of programming is solving problems using the 'chunks' of a programming language. Of course, the chunks must be appropriate for the type of problems to be solved. Generally, smaller chunks are applicable to many types of tasks, but involve more effort; larger chunks involve less effort, but are designed for more specific tasks.
Solving problems with programs is made easier if we can reuse the same or similar solutions that already exist. We do this using the 'chunks' provided by a language, as described in the previous resources. These sections describe the larger 'chunk' features of C++. Larger 'chunks' consist of programming statements used to write a program and to complete programs or portions of programs that reside in libraries.
The section "Classes and Inheritance" explains and illustrates classes, which enable reuse of large sections of programming code. "Templates" explains and illustrates generic programming using templates. Focus specifically on the Introduction, Function Templates, and Class Templates. It also discusses STL, the standard C++ library. Note that 'list' is a template in C++.
This article provides an overview of the elements of C++; specifically, the 'C' portion of C++.
Note how section 2.2 describes tokens as the "minimal chunks of a program". The root goal of programming is solving problems using the 'chunks' of a programming language. Of course, the chunks must be appropriate for the type of problems to be solved. Generally, smaller chunks are applicable to many types of tasks, but involve more effort; larger chunks involve less effort, but are designed for more specific tasks.Compatibility of C and C++C gradually evolved into C++, although C is still often used. It is possible to mix the two in a single program. This article discusses the compatibility of C and C++. Compatibility of two programming languages refers to the extent to which a program written in one of the languages can be used without modification in the other. Compatibility includes both syntax (grammar) and semantics (the execution of grammatical statements). C and C++ have a degree of upward-compatibility, but there are differences since they are distinct languages that have evolved separately.
2.2: Java Background
Read this page to get the background of the Java programming language. Its history is most interesting.
This page extends on the previous resource to delve deeper into Java itself, relating its use to its history.
- Read Chapter 1, which describes how a 'system' can solve many types of problems. A 'system' consists of a computer (hardware components that carry out machine language instructions), software (programs written in a programming language, in particular Java), a communications interface (that interconnects the computer to a worldwide network of other computers), and an interface (that enables users to access data from and run programs on many of the computers in the network).
While the operation of 'the system' applies to many programming languages, this chapter points out features of Java that improve the operation of the 'system', such as device independence via the Java Virtual Machine, OO, reusable class libraries (for user interfacing, event handling), network support, support for other technologies, and suitability for programming other devices.
Unlike C/C++, Java is purely object-oriented. It is essential that you grasp the relationship between computer languages and object-orientation.
In a class hierarchy, a base class is more generic than a class that implements it. In particular, functions or methods of a base class are more generic functions. While generality is desirable, it may be a trade-off with efficiency for certain problems. This section looks at several classes in the class hierarchy for lists and for sets, and the additional features implemented in the subclasses that make them more efficient depending on the problem to be solved.
2.3: Comparing Java and C++
When comparing two programming languages, consider their underlying concepts (goals, principles, model, paradigm), their syntax (grammar), their semantics (what tasks the language can instruct a computer to do), and what support (resources, libraries, tools, etc.) they provide. These considerations can be broken down into a list of specific features that are used to evaluate and compare the two languages. The table in this article describes the similarities and differences between Java and C++.
This video illustrates the different operational processes (compiling and linking) used in C++ and Java. Most of the video discusses the processes for C++, because it is more complicated than that of Java. The Java processes were described more thoroughly earlier in the course.
Unit 2 Assessment
- Receive a grade
Take this assessment to see how well you understood this unit.
- This assessment does not count towards your grade. It is just for practice!
- You will see the correct answers when you submit your answers. Use this to help you study for the final exam!
- You can take this assessment as many times as you want, whenever you want.
Unit 3: C++ Standard Template Library
Nearly every C++ programmer uses the C++ Standard Template Library (STL), a powerful and highly useful library of generic-typed data structures and algorithms. In this unit, we will learn how and why the STL was originally developed. The unit will also introduce you to the history and basics of templates and generic programming before presenting the structures (Containers, Iterators, and Functors) and algorithms that the Standard Template Library contains. By the end of this unit, you will be familiar with the STL, its uses, and its structures and algorithms.
Completing this unit should take you approximately 7 hours.
Upon successful completion of this unit, you will be able to:
- describe the basic components used in the C++ Standard Template Library;
- demonstrate the various components within the C++ Standard Template Library; and
- solve simple problems using C++ template programming.
3.1: History and Motivation
Read this page to gain insight into the history of C++' Standard Template Library. You will see that it did not suddenly appear on the scene. Also, its ideas have been incorporated into other languages. In particular, its support of data-generic programming is important to the construction and flexibility of modern systems.
3.2: Main Design Ideas
Paraphrasing the introduction, this video introduces STL, a formal part of the modern C++ language standard. The speaker demonstrates many STL core features (iterators, algorithms, and data structures). He elaborates on technical details in very substantive way. STL, is a C++ library of classes, algorithms, and iterators, while providing many fundamental algorithms, data structures, and templates.
Watch this video, which discusses the principles of the C++ STL (Standard Template Library) and describes abstraction as it pertains to algorithms and data.
There are different kinds of abstraction. For hardware, we used part-whole abstraction to decompose a computer into its module hierarchy. In this lecture, you encounter part-whole abstraction for data, but one based on generality for algorithms – when an algorithm is a special case of another algorithm, the latter is more general than the former. The discourse leads to object-oriented and generic programming.
STL is an organized collection of generic algorithms applicable to a more general collection of problems and tasks. STL templates include Containers, Iterators, Algorithms, and Functors. In this long, but illuminating video, the lecturer gives his insight into the development of STL, its benefits and limitations. Focus on the parts of the lecture that relate to abstraction and composition, and the process of creating programs.
3.3: The Elements of C++ STL
Software engineering implements general computation using four fundamental steps: requirements, design, code, and validation. In process terms, this becomes defining a problem or task, designing a solution, coding the solution, and testing the solution. C++ STL supports the transition from designing to coding. To exploit the similarity among problems and tasks, it is beneficial to reuse existing designs and code on new problems and tasks. The principle concepts of modularity, abstraction and composition support reusability. This article shows how programming languages implement these principles using data, expressions, functions, and control statements. Essentially C++ STL, and also Java Container Library, are a set of pre-tested trusted modules that implement standard data structures, containers, traversals, and data manipulations.
Study these slides for a good foundation discussion of generic programming concepts. The examples are in C++ but the principles apply also to Java.
The objective of the programming process is a solution to a problem or to complete task. The programming process itself includes requirements development (understanding the problem), design (formulating a plan or strategy), implementation in a programming language (completing the plan by providing details from previous or known solutions), verification and validation (checking the solution). Given a specific problem (program), we can develop a specific solution (specific program); or, we could use abstraction to view the program generically, and develop a generic solution. Using generic functions and generic data structures, a generic design and generic implementation can be developed that will solve, not just a specific problem, but a general class of problems. That is the idea of generic programming; a form of reuse on a large scale, of requirements, design, and implementation.
Libraries of Templates and Containers are an approach to generic programming. One approach to generic programming is a capability that allows functions that apply to more than one type of data (polymorphism). For example, a generic search should work for searching data of any type, as long as the data is comparable.
Read this chapter, which covers iterators for groups of classes in contiguous memory.
Read this article, which further discusses the STL.
Read Chapter 2 for an introduction to basic STL classes and their application.
Use this reference to get at the nuts and bolts of C++ Standard Template Library.
A functor is a name for a function object, which is an object that is called like a function.
Unit 3 Assessment
- Receive a grade
Take this assessment to see how well you understood this unit.
- This assessment does not count towards your grade. It is just for practice!
- You will see the correct answers when you submit your answers. Use this to help you study for the final exam!
- You can take this assessment as many times as you want, whenever you want.
Unit 4: Java Container Library
Java's Container Library is comparable to C++ Standard Template Library. Both provide a set of data containers and associated operations. As you build systems of increasing complexity, you will notice that you use certain data structures and operations on the data and structures over and over again. Experience over decades of computer science has identified a common set. Those have been collected into a group of classes of generic data type. This group is the Standard Template Library in C++ and the Container Library in Java. What we have is a set of trusted modules that have been tested and tested, over and over again, by many people engaging with numerous applications. They are also optimized for speed. There is no reason to write these from scratch. Having already examined the C++ Standard Template Library, we now take a deep look at the Java Container Library.
Completing this unit should take you approximately 5 hours.
Unit 5: Exceptions
A programmer must ensure the correct execution of their code, regardless of the situation the code encounters. In other words, if a run-time error occurs, the program should present the user with relevant information and then quit gracefully. The built-in C++ and Java structures used to accomplish this goal are known as exceptions. This unit will introduce you to the concept of throwing and catching exceptions when something goes wrong while your software is running, explain how exceptions are used in C++ and Java, and teach you how to handle the errors that exceptions catch. By the end of this unit, you will be able to write programs that perform gracefully whenever run-time errors occur.
Completing this unit should take you approximately 6 hours.
Unit 6: Recursion
Often considered one of the more conceptually difficult concepts within the field of computer science, recursion – the act of a function invoking itself – is a powerful and relevant tool. In this unit, we will take an in-depth look at recursion, learning how to develop recursive processes, the role that recursion plays in common data structures, and what happens inside the computer when a function is invoked recursively. By the end of this unit, you will recognize situations that require recursion and be able to apply it appropriately.
Recursion can be a difficult concept for students new to computer science. If you feel anxious, your best best is to use examples. In this unit, we will use recursion to write a program to express factorials (N!). This straightforward example will give you an overview of all the major components of recursion. Many good examples are also illustrated through the unit, particularly in the sections that discuss the Towers of Hanoi and the Merge Sort.
Completing this unit should take you approximately 7 hours.
Unit 7: Searching and Sorting
As a computer programmer, you need to know how to search and sort data. This will require you to leverage what you have learned in a number of different computer science areas, drawing from your earlier study of data structures and algorithms. In this unit, we will identify the importance of searching and sorting, learn a number of popular searching and sorting algorithms, and determine how to analyze and appropriately apply them. By the end of this unit, you will recognize instances in which you need a searching or sorting algorithm and be able to apply one efficiently.
Completing this unit should take you approximately 8 hours.
Course Feedback Survey
Please take a few minutes to give us feedback about this course. We appreciate your feedback, whether you completed the whole course or even just a few resources. Your feedback will help us make our courses better, and we use your feedback each time we make updates to our courses.
If you come across any urgent problems, email contact@saylor.org or post in our discussion forum.
Certificate Final Exam
Take this exam if you want to earn a free Course Completion Certificate.
To receive a free Course Completion Certificate, you will need to earn a grade of 70% or higher on this final exam. Your grade for the exam will be calculated as soon as you complete it. If you do not pass the exam on your first try, you can take it again as many times as you want, with a 7-day waiting period between each attempt.
Once you pass this final exam, you will be awarded a free Course Completion Certificate.
- Receive a grade Receive a pass grade
Saylor Direct Credit
Take this exam if you want to earn college credit for this course. This course is eligible for college credit through Saylor Academy's Saylor Direct Credit Program.
The Saylor Direct Credit Final Exam requires a proctoring fee of $5. To pass this course and earn a Proctor-Verified Course Certificate and official transcript, you will need to earn a grade of 70% or higher on the Saylor Direct Credit Final Exam. Your grade for this exam will be calculated as soon as you complete it. If you do not pass the exam on your first try, you can take it again a maximum of 3 times, with a 14-day waiting period between each attempt.
We are partnering with SmarterProctoring to help make the proctoring fee more affordable. We will be recording you, your screen, and the audio in your room during the exam. This is an automated proctoring service, but no decisions are automated; recordings are only viewed by our staff with the purpose of making sure it is you taking the exam and verifying any questions about exam integrity. We understand that there are challenges with learning at home - we won't invalidate your exam just because your child ran into the room!
Requirements:
- Desktop Computer
- Chrome (v74+)
- Webcam + Microphone
- 1mbps+ Internet Connection
Once you pass this final exam, you will be awarded a Credit-Recommended Course Completion Certificate and can request an official transcript.
- Desktop Computer