* NOTE: This unit may be considered on-going as concepts and skills are used all throughout year 1 and 2.
Use of programming languages
Sub-programmes and objects support abstraction, which facilitates: ease of debugging and maintenance, reuse of code, modularity.
Start by discussing the role of sub-procedures in solving a problem. (Modularization)
Discuss the need for sub-programmes and collections within programmed solutions. Show an understanding of the usefulness of reusable code and program organization for the individual programmer, team members and future maintenance.
Construct algorithms using pre- defined sub-programmes, one- dimensional arrays and/or collections.
Outline the general nature of an object. An object as an abstract entity and its components—data and actions. Familiar examples from different domains might be people, cars, fractions, dates and music tracks.
Distinguish between an object (definition, template or class) and instantiation. Students must understand the difference in terms of code definitions, memory use and the potential creation of multiple instantiated objects.
Construct unified modelling language (UML) diagrams to represent object designs.
Interpret UML diagrams.
Describe the process of decomposition into several related objects. A simple example with 3–5 objects is suggested. Examples related to D.1.1 could be employers, traffic simulation models, calculators, calendars, media collections.
Describe the relationships between objects for a given problem. The relationships that should be known are dependency (“uses”), aggregation (“has a”) and inheritance (“is a”).
Outline the need to reduce dependencies between objects in a given problem. Students should understand that dependencies increase maintenance overheads.
Construct related objects for a given problem. In examinations problems will require the students to construct definitions for no more than three objects and to explain their relationships to each other and to any additional classes defined by the examiners.
Explain the need for different data types to represent data items. The data types will be restricted to integer, real, string and Boolean.
Describe how data items can be passed to and from actions as parameters. Parameters will be restricted to pass- by-value of one of the four types in D.1.6. Actions may return at most one data item.
Features of OOP
Define the term encapsulation. Data and actions are limited to the object in which they are defined.
Define the term inheritance. A parent object holds common data and actions for a group of related child objects. Multiple inheritance is not required.
Define the term polymorphism. Actions have the same name but different parameter lists and processes.
Explain the advantages of encapsulation. For example, the scope of data should be confined to the object in which it is defined as far as possible in order to limit side effects and dependencies.
Explain the advantages of inheritance. For example, a parent object holds common data and actions, which enhances reuse and reduces maintenance overheads.
Explain the advantages of polymorphism. For example, an action in a child object may choose to override actions of a parent object. This allows an external program to use the same action on a family of objects without knowing the implementation detail.
Describe the advantages of libraries of objects. For example, sorts and other complex algorithms and processes do not have to be “re-invented”.
Describe the disadvantages of OOP. For example, increased complexity for small problems; unsuited to particular classes of problem.
Discuss the use of programming teams. As compared to individuals working alone. Examples include speed to completion, information hiding to reduce module dependencies, expertise in narrow fields (eg testing, documentation), etc.
Explain the advantages of modularity in program development. Advantages include easier debugging and testing, speedier completion, etc.
Program development in OOP
Define the terms: class, identifier, primitive, instance variable, parameter variable, local variable.
Define the terms: method, accessor, mutator, constructor, signature, return value.
Define the terms: private, protected, public, extends, static.
Describe the uses of the primitive data types and the reference class string. In examination questions the primitive types will be limited to int, long, double, char and Boolean.
Construct code to implement assessment statements D.3.1–D.3.4. Students may be asked to trace, explain or construct algorithms using the concepts associated with the terms.
Construct code examples related to selection statements. Students may be asked to trace, explain or construct algorithms using simple and compound if ... else constructs.
Construct code examples related to repetition statements. Students may be asked to trace, explain or construct algorithms using for, while or do ... while loops.
Construct code examples related to static arrays. Students may be asked to trace, explain or construct algorithms using static arrays.
Advanced Program Development (HL Only)
Define the term recursion.
Describe the application of recursive algorithms. Students should understand that recursion can be applied to a small subset of programming problems to produce elegant solutions. Students should also understand that recursive algorithms are rarely used in practice.
Construct algorithms that use recursion. This is limited to a method that returns no more than one result and contains either one or two recursive calls.
Trace recursive algorithms. All steps and calls must be shown clearly.
Define the term object reference. As typified by simple classes that are self-referential.
Construct algorithms that use reference mechanisms.
Identify the features of the abstract data type (ADT) list. Students should understand the nature of an ADT—where no implementation details are known but the actions/methods are standard.
Describe applications of lists. Students should understand that lists can be used to represent stacks and queues.
Construct algorithms using a static implementation of a list. Lists will be restricted to singly linked types. Methods that should be known are add (head and tail), insert (in order), delete, list, isEmpty, isFull.
Construct list algorithms using object references. Lists will be restricted to singly linked types. Methods that should be known are add (head and tail), insert (in order), delete, list, isEmpty, isFull.
Construct algorithms using the standard library collections included in JETS. The classes are ArrayList and LinkedList. Students should have a broad understanding of the operation of these lists and their interface (methods) but not of the internal structure.
Trace algorithms using the implementations described in assessment statements D.4.9–D.4.11. In examination questions, definitions of ArrayList and LinkedList methods will be given where necessary.
Explain the advantages of using library collections. Students should understand that libraries provide convenient and reliable implementations of common programming tasks.
Outline the features of ADT’s stack, queue and binary tree. Students should be able to provide diagrams, applications and descriptions of these ADTs. For example, they should know that a binary tree can be used to efficiently store and retrieve unique keys.
Explain the importance of style and naming conventions in code. Students should understand that meaningful identifiers, proper indentation and adequate comments all improve the readability of code for humans and thus save money, time and effort in programming teams.
Abstraction - A model of a complex system that includes only the details essential to the viewer. An abstraction leaves only the information necessary to accomplish our goal. Abstraction tries to reduce and factor out details so that the programmer can focus on a few concepts at a time. Example: A student buying food from the cafeteria does not need to know how it was cooked or what the ingredients are or how much salt was put in. You are only concerned with how much to pay, how good it tastes and how it will satisfy your hunger.
Introduction to Object Oriented Programming
Abstraction, Objects, Classes
http://www.youtube.com/watch?v=0yEBBCfaIZk
http://www.youtube.com/watch?v=uCds47J_Ac8
http://www.youtube.com/watch?v=rDXuPBjVfSc
Encapsulation
http://www.youtube.com/watch?v=Y4_SB96DXEo
Inheritance and Polymorphism