📜 ⬆️ ⬇️

Lectures Technopark. 1 semester C / C ++

We continue our weekly publications of Technopark educational materials. Previous lectures were devoted to web technologies in general, as well as algorithms and data structures . The third block of lectures tells about languages ​​C and C ++.

Lecture 1. Language C. Fundamentals of the organization and use of operational and super-operational memory


The lecture begins with an introduction to the C language: it tells about the history of its appearance, features, advantages and disadvantages, about the spheres of application. The fundamentals of preprocessing are described, memory management issues are considered (memory management models, storage objects scopes), and C program performance. The binding of storage objects and their initialization are discussed. Then it is told about memory classes in C. Finally, the POSIX standard and portability issues are discussed.



Lecture 2. Additional questions of the organization and use of RAM and super-operative memory


The lecture begins with a consideration of multi-dimensional arrays. The example of a two-dimensional array shows an efficient traversal. An example of the problem of multiplying matrices is analyzed, vectors of vectors are discussed. The following is a set of index questions:

Then it describes the use of functions in relation to multidimensional arrays, and arrays of variable length. The following discusses the alignment and packaging of variable compound types, including the reorganization of data structures. We consider the optimization of cache load: the asymmetry of conditions, the embedding of functions. The final part of the lecture is devoted to the system aspects of the allocation and release of memory. In particular, it tells about the four parts of the data memory structure.
')


Lecture 3. Special Encapsulation Issues


Encapsulation is one of the three basic principles of object-oriented design. First of all, it describes what encapsulation is. It gives the definition of a class, understands its composition, lists the existing types of classes. The class objects, including constant ones, class attributes and methods, bit fields and nested classes are considered in detail. The following describes the different types of class methods (static and non-static, embedded, constant, unstable), as well as pointers to them. Then the so-called friendly classes and functions are considered. Toward the end of the lecture, we talk about association classes, anonymous and unnamed associations, bit fields in the definition of classes. The final part of the lecture is devoted to designers and destructors.



Lecture 4. Special questions of inheritance and polymorphism. Multiple and virtual inheritance. Dynamic Type Identification (RTTI)


At the beginning of the lecture, initialization without a constructor, default constructors, constructors with parameters, closed and protected constructors are discussed. The following describes the mechanisms of term-based initialization and assignment, copying constructors, conversion operations, and destructors, including virtual ones. The RAII idiom (Resource acquisition is initialization), the explicit call of destructors and the initialization list in the constructor are discussed. It tells about the translation in C ++ 11, including semantics and the transport constructor. Further, such basic principles of OOP as inheritance (early and late binding, basic and derived classes) and polymorphism (protected and closed members of a class, overloading and overlapping of members of a class) are discussed. Then it talks about calling constructors and destructors of derived classes, initialization list for inheritance, virtual functions and abstract classes. It tells about virtual and multiple inheritance. At the end of the lecture, such issues as dynamic runtime type identification (RTTI) and type casting operations, performance and security of polymorphism and RTTI support tools are discussed.



Lecture 5. Class templates and methods. Exception handling. Generalized and secure programming


At the beginning of the lecture, the definition of class templates is given and their parameters are considered. The mechanism for instantiating class templates is explained. It tells about the methods of templates, about friendly objects in templates, about static members, about specialization of templates, including full and partial ones. As an example of metaprogramming, recursive definition of patterns is considered. The essence of the new idiom, SFINAE (Substitution failure is not an error), is explained, including in relation to compile-time introspection. A solid part of the lecture is devoted to all types of characteristics. It tells about the technology of processing exceptional situations. The next block of information is dedicated to safe programming: security classes, methods, constructors and destructors, safety criteria and code neutrality. At the end of the lecture, various exceptions are discussed in the standard library.



Lecture 6. Practical introduction to STL. Functional programming in C ++


First, it describes the history of the creation of the Standard Template Library (STL): prerequisites, the purpose of STL, and performance guarantees. Further details about all the components included in the STL:

We consider the relations of comparison in algorithms, inverse relations, operations on sets and heaps. Then it talks about STL iterators, their views (including insert iterators and stream iterators), ranges supported by iterators, and operations. Toward the end of the lecture, standard STL functional objects and their base classes are discussed. Provides information about adapters (container, functional). At the end, the issue of using containers in STL is raised.



Lecture 7. Practical introduction to Boost


The lecture begins with a story about lambda functions, the basic rules for their design, key advantages and the use of closures. Then discusses Boost (a set of several dozen autonomous libraries), its composition and purpose. The main part of the lecture is devoted to examining examples of using Boost: compile-time checking, type characteristics, variant containers, smart pointers. The report concludes on the use of Boost tools to improve code performance and security.



Lecture 8. Principles and patterns of object-oriented design. Basic Templates, GoF Templates


The lecture opens with a lengthy discussion of the goals, problems and principles of object-oriented design. The following describes design patterns: what it is, what kinds of patterns are, and what are their advantages. The basic templates and their implementations are considered:

After that understand the three groups of GoF templates. Generating patterns:

Structural patterns:

Behavioral patterns:

Finally, the SOLID principles are explained.



Lecture 9. Idiom of C ++. Basics of refactoring and quality source code. Coding Standards and Software Development Methodology


The final lecture in this course. First, the definition of the term “idiom of programming language” is given. It tells about the idioms of procedural programming, about object-oriented idioms. The methods of memory management related to idioms of increased complexity are discussed:

The next part of the lecture is devoted to refactoring and static analysis of the source code: definitions are given, it discusses possible applications, advantages, disadvantages and associated risks are considered. Next, understand the typical anti-patterns, "dirty technology", logical and semantic errors. Discusses issues of optimizing programs in terms of performance, size of object code and data memory. Then the concept of "quality software" is considered, functional and structural indicators of code quality are described. It describes the models and factors of software quality, including the McCall model. The following describes the complexity of the code as an attribute of software quality, how to manage complexity, and how modularity affects it. Then the concept of “technical duty”, standards and styles of code, industrial development methodologies (rules of organization and methods of recording, commenting and documentation, software development life cycle, its models) are considered. And at the end of the course, a review of SWEBoK (Software engineering body of knowledge) is given.

Source: https://habr.com/ru/post/253095/


All Articles