1 / 516

Advanced Programming Techniques

Advanced Programming Techniques. Dr.- Ing . Harald Köstler 18.10.2010. Educational Goals, Lecture, Exercises, Exam, Contents, Literature . Organization and Motivation. Educational Goals. Know basics of C++ and object-oriented programming

milton
Télécharger la présentation

Advanced Programming Techniques

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Programming Techniques • Dr.-Ing. HaraldKöstler • 18.10.2010

  2. Educational Goals, Lecture, Exercises, Exam, Contents, Literature Organization and Motivation

  3. Educational Goals • Knowbasicsof C++ andobject-orientedprogramming • Beableto do modular andefficientimplementationsofalgorithms • Apply design patternsandstructureyoursoftware • What do youexpectfromthelecture?

  4. Lecture • First partmainlybased on C++ Primer • Lessslides, morecodediscussions • Bring yourlaptopandworkaloneor in pairs • Askandgivefeedback • Change ofschedule • Monday 8:30-10:00, 0.111 • Tuesday 8:30-10:00, 0.111

  5. Exercise • Responsible: K. Iglberger • Hand in ALL exercises • Exercisesheetsarefound online • http://www10.informatik.uni-erlangen.de/Teaching/Courses/WS2010/AdvProg/ • Schedule • Monday 16:00-17:30, 01.155 • Friday 12:30-14:00, 0.141

  6. Organization • Youmayuse all operatingsystems (Linux, Mac OS, Windows) • Compilers, e.g. g++ or cl (Visual Studio) • Learntoprogramplatformindependent! • Prepare simple mainprogramforsmalltests • Why C++? • Object-orientedlanguage • Supports mostprogrammingparadigms • Usedbymanyresearchersandcompanies • suitablefor HPC (?!)

  7. Contents • Part I : C++ • Introduction to C++ • Introduction to the C++ standard library • Basic Object Oriented Concepts • Advanced C++ Features • Part II : (Parallel) Software Design • Design Patterns and Software Engineering • Parallel Programming Concepts • Introduction to Parallel Programming Paradigms

  8. Contents: Part I : C++ • Introduction to C++ • Variables, Types, Pointers • Expressions, Statements • Functions • Basic Object Oriented Concepts • Classes, Overloading, OO Programming • Introduction to the C++ standard library • IO library • Containers, Generic Algorithms

  9. Contents: Part I : C++ (continued) • Advanced C++ Features • Generic Programming and Templates • Exceptions, namespaces • Multiple andvirtualinheritance • Special C++ andstandardlibraryTechniques (e.g. run-time type identification, unions) • Expression Templates and Template Meta Programming • C++ codingrulesandprogrammingparadigms • The Boostlibrary

  10. Contents: Part II : (Parallel) Software Design • Design Patterns and Software Engineering • Basic Software Engineering concepts • Design Patterns • Software engineering@LSS: PE engineandwaLBerlaframework • Introduction to Parallel Programming Concepts and GPU Programming with CUDA/OpenCL • Summary and questions

  11. Exam • Mainlybased on C++ Primer • Date: February on a Monday • Test exam in Dezember • Categories: • Reproduceandexplainterms in C++ and OO • Explainsyntaxandsemanticof C++ programs • Find errors in codefragmentsandcorrectthem • Write ownclassesandfunctions • Mapproblemstoclassesandalgorithms • Apply simple design patterns

  12. Literature • S. Lippman et al, C++ Primer, 4th edition. Addison Wesley, 2005 (www.awprofessional.com/cpp_primer) • Andmanymore

  13. C++ Keywords

  14. Test • Explain: • Template • standardlibrary • operatoroverloading • expressionvsstatement • memberfunction • List standardlibrarycontainers • Describethe singleton design pattern

  15. Basics Introduction to C++

  16. The first C++ program • Terms: • statement, block, curly brace • function, function name, parameter list, function body • return type, argument • Questions: • How to compile and run program in Linux/Windows? • How to get return value in Linux/Windows?

  17. Programming Language Features I • Essentially all programming languages provide: • Built-in data types (integers, characters, …) • Expressions and statements to manipulate values of these types • Variables, to name the objects we use • Control structures (if, while, …) to conditionally execute or repeat a set of actions • Functions to abstract actions into callable units of computation • But Programming languages also have distinctive features that determine the kinds of applications for which they are well suited

  18. Programming Language Features II • Most modern programming languages supplement this basic set of features in two ways: • they let programmers extend the language by defining their own data types • they provide a set of library routines that define useful functions and data types not otherwise built into the language.

  19. Definitions

  20. Definitions

  21. Definitions

  22. Standard IO • Terms: • variable, built-in type, expression, comment • standard library and IO, header, preprocessor directive • input/output operator, namespace, scope operator • Questions: • What means flushing a buffer? Why do so? • When to initialize variables?

  23. Definitions

  24. Definitions

  25. Definitions

  26. Definitions

  27. Definitions

  28. Definitions

  29. Definitions

  30. Definitions

  31. Definitions

  32. Definitions

  33. While Statement I • Terms: • condition • compound assignment operator, prefix increment

  34. Definitions

  35. Definitions

  36. Definitions

  37. Reading inputs • Questions: • How many inputs are read?

  38. Definitions

  39. ForandIf Statement

  40. Definitions

  41. Classes • Terms: • data structure, class, member functions / methods • dot operator

  42. Definitions

  43. Definitions

  44. Sales_item.h: classdefinition (expert)

  45. Sales_item.h: classimplementation I (expert)

  46. Sales_item.h: classimplementation II (expert)

  47. Advanced Programming Techniques – Lecture 2 • Dr.-Ing. HaraldKöstler • 19.10.2010

  48. Variables and Basic Types – C++ Primer Chapter 2 Introduction to C++

  49. CodingConventionsforExercisesandExam • Intendyourcodeconsistently • Start a newlineforeachstatement • Namingconventions • Ownobjectnames: LikeThis • variables: likeThis • Class members: likeThis_ • Macros: LIKE_THIS • Integer types: i,j,k • Floating point: x,y,z • Comment yourcode, e.g. in declarationwhen variable isinitialized

  50. Useful Tipps • plan-edit&comment-compile-debug-test • Compilecleanlyathighwarninglevels • Wall • Knowcompileroptions: g++, cl • Use an automatedbuildsystem • Make, cmake • Use a versioncontrolsystem (biggercodes) • svn • Invest in codereviews • Debuggers: gdb, ddd • Valgrind • Profilers: gprof

More Related