How To Program A Computer



Similar documents
Object Oriented Software Design

CMSC 435: Software Engineering Course overview. Topics covered today

Object Oriented Software Design

Algorithm & Flowchart & Pseudo code. Staff Incharge: S.Sasirekha

Informatica e Sistemi in Tempo Reale

The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings

Chapter 12 Programming Concepts and Languages

School of Computer Science

How to Write a Marketing Plan: Identifying Your Market

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Research Data Management CODING

Algorithms are the threads that tie together most of the subfields of computer science.

Object Oriented Software Design - I

Program Your Own Game

Architecture Artifacts Vs Application Development Artifacts

Data Integration and Exchange. L. Libkin 1 Data Integration and Exchange

Systems Engineering and Integration for the NSG (SEIN) SharePoint Developer

The Secret Formula for Webinar Presentations that Work Every Time

Bachelor of Games and Virtual Worlds (Programming) Subject and Course Summaries

VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University

McGraw-Hill The McGraw-Hill Companies, Inc.,

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari:

Chapter 2: Algorithm Discovery and Design. Invitation to Computer Science, C++ Version, Third Edition

Curriculum Map. Discipline: Computer Science Course: C++

Traveling Circuits Lesson 3 MY ROBOTIC FRIENDS

Design Patterns in C++

Chapter 12 Making Meaning in Algebra Examining Students Understandings and Misconceptions

Chapter 13: Program Development and Programming Languages

Wilson Area School District Planned Course Guide

Chapter 13: Program Development and Programming Languages

Resume Writing Resources

Masters in Computing and Information Technology

Exploratory Testing Dynamics

Datavetenskapligt Program (kandidat) Computer Science Programme (master)

Fall 2012 Q530. Programming for Cognitive Science

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Ch. 10 Software Development. (Computer Programming)

Management Information Systems 260 Web Programming Fall 2006 (CRN: 42459)

Becoming an Online Learner

Object Oriented Software Design II

Objectives. Python Programming: An Introduction to Computer Science. Lab 01. What we ll learn in this class

How To Program With Adaptive Vision Studio

MODULE CO-ORDINATOR HANDBOOK. Collaborative Partners

NEW YORK CITY COLLEGE OF TECHNOLOGY/CUNY Computer Systems Technology Department

Python Programming: An Introduction to Computer Science

Chapter 6: Programming Languages

COURSE TITLE COURSE DESCRIPTION

An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008

Information and Communications Technology Courses at a Glance

Java in Education. Choosing appropriate tool for creating multimedia is the first step in multimedia design

KS3 Computing Group 1 Programme of Study hours per week

Masters in Information Technology

School of Computer Science

Masters in Human Computer Interaction

CSCI 3136 Principles of Programming Languages

Masters in Advanced Computer Science

Visual Programming of Logic, Motion, and Robotics

Java Programming (10155)

Masters in Artificial Intelligence

Pre-Masters. Science and Engineering

A LOOK BACK: UNDERGRADUATE COMPUTER SCIENCE EDUCATION: A NEW CURRICULUM PHILOSOPHY & OVERVIEW

The Application of Visual Basic Computer Programming Language to Simulate Numerical Iterations

Masters in Networks and Distributed Systems

OUR COURSES 19 November All prices are per person in Swedish Krona. Solid Beans AB Kungsgatan Göteborg Sweden

STRAND: Number and Operations Algebra Geometry Measurement Data Analysis and Probability STANDARD:

1. Overview of the Java Language

COMPUTER SCIENCE. FACULTY: Jennifer Bowen, Chair Denise Byrnes, Associate Chair Sofia Visa

Introduction to programming

Instructor Özgür ZEYDAN BEU Dept. of Enve. Eng. CIV 112 Computer Programming Lecture Notes (1)

02-201: Programming for Scientists

COMPUTER SCIENCE Introduction to Programming: Visual Basic 1 CIHS C++ AP Java

Object Oriented Software Design II

Engineering Process Software Qualities Software Architectural Design

Sources: On the Web: Slides will be available on:

Game Design From Concepts To Implementation

CS 40 Computing for the Web

What is a programming language?

developer.* The Independent Magazine for Software Professionals

Guide to the MSCS Program Sheet

School of Computer Science

University of Dayton Department of Computer Science Undergraduate Programs Assessment Plan DRAFT September 14, 2011

Critical analysis. Be more critical! More analysis needed! That s what my tutors say about my essays. I m not really sure what they mean.

TEACHER S GUIDE TO RUSH HOUR

CHIPPEWA STUDY SKILLS. Helpful Hints for Test and. Exam Preparation. Brought to you by Chippewa Resource and Student Success

Lecture Overview. Object-Oriented Software Engineering: Using UML, Patterns, Java, and Software Development Processes. Prof. Dr.

Games Development Education to Industry. Dr. Catherine French Academic Group Leader Games Programming, Software Engineering and Mobile Systems

Intro to the Art of Computer Science

Jos Warmer, Independent

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

Automated Virtual Cloud Management: The need of future

UNDERGRADUATE COMPUTER SCIENCE EDUCATION: A NEW CURRICULUM PHILOSOPHY & OVERVIEW

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

Bachelor of Information Technology (Incorporating Diploma in Information Technology (Levels 5 and 6)

Cross-Cultural Communication Training for Students in Multidisciplinary Research Area of Biomedical Engineering

Stop being Rails developer

4.1. Title: data analysis (systems analysis) Annotation of educational discipline: educational discipline includes in itself the mastery of the

2 Computer Science and Information Systems Research Projects

A UML Introduction Tutorial

not think the same. So, the consumer, at the end, is the one that decides if a game is fun or not. Whether a game is a good game.

Transcription:

Object Oriented Software Design Introduction Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 23, 2010 G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 1 / 32 Outline 1 Summary of the course 2 Introduction 3 Learning to program 4 The human factor 5 How to become a master G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 2 / 32

Organization of the course The course is divided into 2 semesters, each one entitles to 6 credits The first semester is open to students of: GPIST IMCNE MAPNET The second semester is open to students of: GPIST Allievi of Scuola Sant Anna G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 4 / 32 First semester First semester Exam: Objective: to acquire basics knowledge of object oriented design and programming Abstract Data Types Programming in Java and in C++ In both languages: Inheritance, vs. composition, when and when not? Exception safety Design for re-use Testing while programming Generics 3 assignments: 2 small programs, plus one bigger to be developed during the course and handed over at the end For MAPNET and IMCNE only: an oral examination G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 5 / 32

Second semester Design Patterns How to reuse existing knowledge Software Engineering Requirement Analysis Classical Software life cycles Agile and Xtreme programming Tools The Boost library CVS, SVN, (git?) Tools for testing Documentation Concurrent Programming The Boost thread library Distributed Middleware Design Patterns for Distributed Concurrent Programming Exam: A project and oral examination. G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 6 / 32 Books and material Java Programming Bruce Eckel s Thinking in Java Sun s documentation and Tutorials C++ Programming Stroustup s C++ Language (Language reference) Bruce Eckel s Thinking in C++, Volume 1 (Learning C++) Herb Sutter s Exceptional C++ (Advanced Tips and Tricks) Alexandrescu s Modern C++ programming (Meta-programming with Templates) And of course, these slides, and various material to be found over the Internet G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 7 / 32

Something to think about Computer science is no more about computers than astronomy is about telescopes What else might it be about? Edsger Dijkstra G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 9 / 32 Algorithms, programs, processes Algorithm: It is a logical procedure thought to solve a certain problem It is informally specified as a sequence of elementary steps that an execution machine must follow to solve the problem it is not necessarily expressed in a formal programming language! Program: It is the implementation of an algorithm in a programming language, that can be executed by an autonomous machine (calculator) It can be executed several times, every time with different inputs Process: An instance of a program that, given a set of input values, produces a set of outputs G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 10 / 32

Algorithm Given a computational problem, it is necessary to find a procedure, consisting of a finite set of simple steps that will produce the solution of the problem. Such a procedure is called Algorithm in honor of arab mathematician Mohammed ibn-musa al-khuwarizmi (VIII century AC) Figure: al-khuwarizmi Examples: How to prepare a coffe How to buy a coffe from the vending machine How to calculate the square root of a number G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 11 / 32 Calculators An algorithm needs a machine to execute it Machine here is intended in the abstract sense It can even be a human being, or group of people However, it is important that the algorithm it is described so that the machine can execute it without further instructions, or wrong interpretation of what to do Therefore, the steps must be simple, and precisely described G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 12 / 32

Coffe time! Example: in the description of the algorithm to prepare a coffe: we must specify how much coffe to put, so that the machine cannot be wrong in preparing it If the machine is a calculator (a stupid machine!), then we must tell it exactly how much coffe to put If the machine is smart, we can be less precise, for example, put coffee until the machine is full (actually, many human beings not not smart enough to prepare a coffe!) G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 13 / 32 Programs In this course, we are interested in describing an algorithm so that a computer can understand and execute it How to communicate with a computer? We need to use a language that the computer can understand A programming language is not so much different than any human language The main difference is that the interpretation of a sentence expressed in a programming language must be unambiguous Human languages, instead, allow plenty of ambiguities! Therefore, a programming language is grounded on a solid mathematical basis G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 14 / 32

Human beings... are very much at the mercy of the particular language which has become the medium of expression for their society. It is quite an illusion to imagine that one adjusts to reality essentially without the use of language and that language is merely an incidental means of solving specific problems of communication and reflection. The fact of the matter is that the real world is to a large extent unconsciously built up on the language habits of the group. The Status Of Linguistics As A Science, 1929, Edward Sapir G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 16 / 32 Learning a programming language Learning a programming language is not so different from learning a natural language First of all, it is important to point out that the structure of the language influences the way we think at problems It is well known that people from different countries tend to think in different ways Natural language is the primary mental knowledge representation system a Therefore, reasoning is heavily influenced by language a See http://en.wikipedia.org/wiki/cognitive_psychology. Image taken from Myth, Ritual, and Symbolism http://bit.ly/cllmgc G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 17 / 32

Natural language To be fluent in another language (e.g. English), it is important to think sentences in that language Thinking a sentence in the mother-toungue (e.g. Italian) and then mentally translate to the new language (e.g. English) often produces unnatural sentences When speaking in a new language, we should also switch to a new way of thinking 1 1 Image taken from Natural Language and the Computer Representation of Knowledge http://bit.ly/ccdzlh G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 18 / 32 Language structure Back to programming languages A low level language (MS Visual Basic, C, etc.) lacks strong structure Emphasis on programs as collection of functions acting on global and local data Correspondingly, low-level programs made by beginners tend to lack in structure When they have, it is difficult to find and understand it G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 19 / 32

Object Oriented Language Structure Object-oriented programming languages favor a structure Emphasis on programs as set of objects communicating through well-defined interfaces Everything is an object! The programmers has to model the world as a set of object G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 20 / 32 Functional programming Functional programming 2 Functional languages impose yet another structure Emphasis on functions as first-class concepts Progams manipulate functions as well as data 2 Comic strip from http://xkcd.com G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 21 / 32

Learning the basics Where to start from? Similarly to learning natural languages, you should start from learning to read and understand programs written by others To understand: you should try to mentally execute the code, just as a computer would do To be able to do this, you have to understand first how the abstract machine executes each part of the program If you learn how to do this, you will not need sophisticated debuggers Then, you can learn to write code, keeping in mind how it is executed by the machine That s the most difficult thing to do, because at the beginning you haven t the right structure in your mind yet G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 22 / 32 Human interaction Computer programming has important social aspects At the beginning you learn to write small programs all by yourself It s you and the PC the teacher gives you an exercise, you have to transform the specification into a program Or, you want to write a program for yourself, so you also give the specification When you code in this way, you have complete control of all the aspects G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 24 / 32

Large programs However, when you become a professional programmer, it s a completely different story Professional programs get larger and larger (tens of thousands of lines of code), and it takes much longer to write them Even if you are the only programmer, you often lose control of what you have done the week before (what was the meaning of that k variable?) Most often, however, the program code is written by a team Depending on the project, the team can consist also of 5-6 programmers, and there can be many teams working on different parts of the same project It is important to learn how to work in a group Therefore, it is important to be able to communicate between partners without misunderstandings The team leadership is a key factor for the success of the project G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 25 / 32 Specification How to communicate with customers? A professional team writes programs for someone else (the customer) So, the customers must tell then team exactly what they want That s the specification Still done in natural language A very difficult aspect Most of the failures in completing/delivering a corrects software project are caused by Wrong or ambiguous initial specification Wrong interpretation of the specification Continuously changing specification after the design G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 26 / 32

Software engineering Software engineering is also a social science Team management Project planning Risk management Dealing with the customer Continuosly evolving specification All these aspects are as important as learning how to program G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 27 / 32 How to become a good software designer How to become a software design master? Engineering approach Lot of experience Learning to develop good software is similar to learning to play good chess G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 29 / 32

How to become a chess master First, learn the rules e.g., names of pieces, legal movements, captures, board geometry, etc. Second, learn the principles e.g., relative value of certain pieces, power of a threat, etc. But principles are abstract. How to apply them in practice? Third, learn the patterns by studying games of other masters These games have certain patterns that must be understood, memorized, and applied repeatedly until they become second nature. G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 30 / 32 To become a software design master First, learn the rules e.g., programming languages, data structures, etc. Second, learn the principles e.g., software engineering principles such as separation of concerns, etc. But principles are abstract. How to apply them in practice? Third, learn the patterns by studying designs of other masters These designs have certain patterns that must be understood, memorized, and applied repeatedly until they become second nature. G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 31 / 32

This course This course is a tentative to form Software Design Masters in Object Oriented software technology A bottom-up approach Object Oriented Languages Programming Techniques Design Techniques An introduction to Software Engineering principles and tools This course has been designed to be interactive I need your help to carry on until the end! G. Lipari (Scuola Superiore Sant Anna) OOSD September 23, 2010 32 / 32