• No results found

Programming Education - a personal interpretation

N/A
N/A
Protected

Academic year: 2021

Share "Programming Education - a personal interpretation"

Copied!
19
0
0

Loading.... (view fulltext now)

Full text

(1)

Objects First

Objects First

Programming Education

- a personal interpretation

Jens Bennedsen It-vest – networking universities It-vest – networking universities,

Denmark [email protected]

Me

20 years of teaching experience

– introductory programming for 20 years

– introductory object-oriented programming for 15 years

Published 20+ articles in the area of computer

science education

– Some in collaboration with Carsten ☺

Writing up my ph.d. thesis “Teaching and learning

programming – a model-based approach”

(2)

Outline of the talk

What is ”objects first”?

– CC2001

Model-driven programming

– program in context

Object-oriented conceptual framework

– “There is more to OO than Java”

A model-driven introductory programming course

– progression teaching material assignments final exam

Free University, Berlin, Germay Objects First Programming Education 3

progression, teaching material, assignments, final exam, ...

Mediation of the programming process

– How to unfold the programming process?

CC2001

CC-2001 describes three approaches to a

program-ming first curriculum

ming first curriculum

– imperative-first – functional-first – objects-first

Free University, Berlin, Germay Objects First Programming Education 4

John Lewis: Myths about Object-Orientation and Its Pedagogy SIGCSE 2000, p. 245 - 249

(3)

Programming Education

in Perspective

Programming Education

Programming Education

= Programming Methodology +

Pedagogical Design +

Programming Methodology

Programming Tools

Programming Methodology = Theory/Techniques + Process Pedagogical Design Pedagogical Design g g g = Organization + Dissemination Programming Tools = Language + Environment Programming Tools

(4)

Many factors influence learning

Student’s learning

premises

E t

l

External

conditions

Objectives

Learning

process

Evaluation

Free University, Berlin, Germay Objects First Programming Education 7

process

Content

Hiim & Hippe 2006

Programming Methodology

Theory/Techniques

= Theory/Techniques + Process

model-driven developmentdesign by contract (assertions)patterns...

Process

incremental development Programming Methodology

Free University, Berlin, Germay Objects First Programming Education 8

incremental developmentnon-linearityrefactoringtest... Pedagogical Design

(5)

Pedagogical Design

Organization

= Organization + Dissemination

graduated exposure to complexityspiral, early bird, fill in the blanksapprenticeship...

Dissemination

text Programming Methodology

Free University, Berlin, Germay Objects First Programming Education 9

textlabsvideoslectures

net-based learning objects

Pedagogical Design

A Conceptual Framework for

Object-Oriented Programming

There is more to OO than Java

There is more to OO than Java...

(6)

Kristen Nygaard on Object-Orientation

A program execution is regarded as a physical model systemsimulating the beha ior of either a real or imaginar behavior of either a real or imaginary part of the world.

Physical modeling is based upon the conception of reality in terms of phe-nomena and concepts.

A physical model system is

construc-Free University, Berlin, Germay Objects First Programming Education 11

p y y

ted, modeling phenomena by objects and concepts by categories of objects.

Kristen Nygaard, 1926-2002

Three Perspectives on Programming

Instructing the computer (coding)

– the purpose of programming is to instruct the computer – focus is on aspects of program execution such as storage

l t t l fl t i t

layout, control flow, parameter passing, etc.

Managing the program description

– the purpose of programming is to create a software architecture that provides overview and understanding of the entire program – focus is on aspects such as visibility, scope, encapsulation,

modularity, software design etc.

Free University, Berlin, Germay Objects First Programming Education 12

Conceptual modeling

– the purpose of programming is to express concepts, structure and relations

– focus is on constructs for describing concepts, phenomena and relations between these

(7)

Conceptual Modelling

d lli Conceptual model Problem/vision concerning Specification model Program, language, abstraction abstraction modelling

Free University, Berlin, Germay Objects First Programming Education 13

concerning phenomenons

g g g

OS, machine

Problem domain Model

Overview

Conceptual framework for object-orientation

– Concepts and modelling

Structure: aggregation association specialization – Structure: aggregation, association, specialization

– is used for organizing knowledge about a problem domain and structure in the solution domain

– Is (to some extend) supported by language constructs in OO languages

Modelling examples

g

p

– Abstract models in UML – Implementation in Java

– Smaller examples from textbook [Barnes & Kölling] – which does not explicitly present the models...

(8)

Association (X-a)

Relation that describes a dynamic relation between

concepts that can exist independently of each other.

MailServer keeps MailItem

Person owns Car Person rents Car

Person loves Person

Person is-friend-with Person

Free University, Berlin, Germay Objects First Programming Education 15

Student is-enrolled-at Course

Patient have-had Disease

Association in UML

MailServer keeps

*

MailItem

*

owns Person Car Student Course 0..1 owned

*

takes

*

can-drive

*

Free University, Berlin, Germay Objects First Programming Education 16

Multiplicity (cardinality): 0..1, 1, n, a..b, 0..* (*) Role

(9)

Association in UML (X-a)

X = keeps

MailServer

howManyMessages(String who): int getNextMailItem(String who): MailItem post(MailItem item)

MailItem

getFrom(): String getTo(): String 0..* from: String to: String message: String

Free University, Berlin, Germay Objects First Programming Education 17

post(MailItem item) getTo(): String getMessage(): String print()

Association in Java

class MailItem {

private String to; private String from; class MailServer {

Set<MailItem> messages;

private String message;

public MailItem( ... ) { ...

}

public String getFrom() { ... }

public String getTo ()

{ }

public MailServer() {

messages = new HashSet<..>(); }

public int

howManyMessages (String who) { ... }

public MailItem

getNe tMailItem (String ho) { ... }

public String getMessage() { ... }

public void print() { ... }

}

getNextMailItem (String who) { ... }

public void

post(MailItem item) { ... }

(10)

Systematics in OOP

Modelling

– from problem description to conceptual model

– refinement of conceptual model to specification model (method signatures and specifications)

Implementation

– structurally: from specification model to Java code (automatically)

b d tt ib t d th d ( ti it d t ti )

Free University, Berlin, Germay Objects First Programming Education 19

– body: attributes and methods (creativity and systematics)

Problem domain

Hand-in-Hand Modeling and Coding (1)

David Gries (Edsger W. Dijkstra)

– the loop body and the loop invariant is developed hand-in-hand with the latter leading the way

with the latter leading the way

We (Kristen Nygaard)

– coding and class modeling is done hand-in-hand with the latter leading the way

Design by contract and systematic programming

Free University, Berlin, Germay Objects First Programming Education 20

Design by contract and systematic programming

– a class model is a design contract in precisely the same way as a loop invariant is

(11)

Programs as models

A program execution is regarded as

K. Nygaard

It’s not the purpose of our programs to instruct the computer; it’s the purpose of the computer

E.W. Dijkstra

p g g

a physical model system

yg

Free University, Berlin, Germay Objects First Programming Education 21

to execute our programs

Contents and Progression

Traditional approach

– typical textbooks only address the first and to some extend the second perspective

– topics are organized according to the syntactical structures in the programming language (bottom-up)

– tendency to completeness in coverage of topics – syntax-driven progression

Our approach

b l d f ll th i

– a balanced coverage of all three views – conceptual modeling is leading the way – systematic programming (killing rabbits) – early bird & spiral approach

(12)

Model-Driven Progression (1)

Model-driven

– programming tasks starts from a class model – programming tasks starts from a class model – mostly, the model is given

– sometimes, also the model must be developed

Progression

– models become increasingly complex during the course – associated systematic programming techniques

Free University, Berlin, Germay Objects First Programming Education 30

associated systematic programming techniques – language issues covered “by need”

Course Progression

Design Conceptual model Problem/vision Specification model Implementation model Analysis Implementation

Free University, Berlin, Germay Objects First Programming Education 31

(13)

Revealing the

Revealing the

Programming Process

Pointing Out the Problem

David Gries, SIGSCE 1974

What Should We Teach in an Introductory Programming Course?

“Suppose you attend a course in cabinetSuppose you attend a course in cabinet making.

The instructor briefly shows you a saw, a plane, a hammer, and a few other tools, letting you use each one for a few minutes.

He next shows you a beautifully-finished bi t

cabinet.

Finally, he tells you to design and build your own cabinet and bring him the finished product in a few weeks.

(14)

Absurd Expectation

?

Free University, Berlin, Germay Objects First Programming Education 34

Nevertheless, this is what traditionally takes place (judged by the majority of existing textbooks)

Predictable Outcome

?

(15)

The Missing Link...

tools concepts language constructs finished programs

?

Free University, Berlin, Germay Objects First Programming Education 36

Strategies, Principles, and Techniques

The Practice of Programming

Describestrategies, principles, and techniques

... of problem solving and the development of programs

tools concepts language constructs finished programs q

Demonstratehow to apply these in action

Developprograms instead of simply

showcasing them

Demonstratethat programming is a

non-linear process

Demonstrateincremental development

Demonstratemodel-driven development

D t t t t d i d l t

Demonstratetest-driven development

Demonstraterefactoring

Demonstratehow to find and handle errors

Demonstratehow to use online

(16)

Strategies, Principles, and Techniques

D

i ti

l

l

... of problem solving and the development of programs

Descriptive level

(theoretical)

tools concepts language constructs finished programs

Free University, Berlin, Germay Objects First Programming Education 38

Performance level

(practical)

Video mediation

Apprenticeship learning

Learning is an integral part of generative social

practice and through legitimate peripheral

participation

Leve and Wenger most well-known

C P

legitimate peripheral ti i ti

Free University, Berlin, Germay Objects First Programming Education 39

(17)

Apprenticeship

Jordan (1989) found

– Work is the driving force. The apprentices’ progressive mastering of tasks is appreciated for “getting the problem solved ” not as a step toward a distant symbolic goal (such as a solved, not as a step toward a distant, symbolic goal (such as a certificate).

– Apprentices start with skills that are expected by the master to be easiest and where mistakes are least costly. (The tailors start out sewing, not cutting, the cloth.)

– Learning is focused on bodily performance. It involves the ability to do, rather than the ability to talk about something. It often focuses on skills rather than academic competencies

Free University, Berlin, Germay Objects First Programming Education 40

focuses on skills rather than academic competencies. – Standards of performance are embedded in the work

environment.

– Teachers and teaching are largely invisible.

Cognitive apprenticeship

“We call this rethinking of teaching and learning in school

“cognitive apprenticeship” to emphasize two issues. First the method is aimed primarily at teaching the processes that experts use to handle complex tasks. Where conceptual and p p p factual knowledge are addressed, cognitive apprenticeship emphasizes their uses in solving problems and carrying out tasks …

Second, our term, cognitive apprenticeship, refers to the learning-through-guided-experience on cognitive and

metacognitive, rather than physical, skills and processes […] The externalization of relevant processes and methods makes possible such characteristics of apprenticeship as its reliance possible such characteristics of apprenticeship as its reliance on observation as a primary means of building a conceptual model of a complex target skill.”

(18)

Two aspects of apprenticeship

Person-centered aspect

– Expose the learners to how an experienced programmer works. – The master reflects and thinks aloud of the particular action,

ki th i ibl d f id tifi ti making them visible and as a source of identification. – The apprentice learns from observing the master (teacher)

performing the actions embedded in a programming practice.

De-centered aspect

– Consider the learner as an active participant in a community of co-learners.

Free University, Berlin, Germay Objects First Programming Education 42

– The master (teacher) legitimates the skills and knowledge of the individual learner.

Nielsen and Kvale (1997)

An Example...

Refinement of class Date

– demonstrating two principles

The special case principlep p p public class Date {

– systematic treatment of special cases

– suppress implementation details – introduce private methods to

handle special cases

The mañana principle

– introduce an abstraction worry about implementation

p { private int

d, // 1 <= d <= daysInMonth m, // 1 <= m <= 12 y;

public Date(int dd, int mm, int yy) { d = dd; m = mm; y = yy;

}

public void setToNextDate() { d = d + 1;

}

Free University, Berlin, Germay Objects First Programming Education 43

– worry about implementation details ”tomorrow”

date udsnit.wmv

}

public String toString() { return d + "-" + m + "-" + y; }

(19)

References

Related documents

• Additional consultant such as an architect, contractor, engineer or developer added to project team to oversee scheduling, cost control, constructability, project

In order to address this issue, we propose two systems: one is Cumiki, a collaborative tutorial creation tool for open source software code hosted on GitHub, and the other one is

The present study found that risk behaviors such as having more male sexual partners and paying for sex were independently associated with willingness to use PrEP, echoing findings

Client may contract with CivicPlus for additional Consulting, Website Design, Setup, Programming, and Training services (Project Development Services) that exceed those defined

The InSight series of interactive software for the Macintosh computer: Laboratory exercises in vision science.. Presented as part of a symposium, Goals of the Trade: Enhancing

The first chapter examines Skempton’s roots and influences from within the movement; the second explains his approach to composition and the clear aesthetic that has developed

a) Sword, a little over 36 inches long, with remains of decayed wood of the scabbard. The blade is two-edged, the hajidle of the type Jan Petersen X, Rygh 501, the pommel

Survey data indicate that 84% of eligible women in Great Britain report having had both breast and cervical screening and 3% report never having been screened for either Screening