Presentation is loading. Please wait.

Presentation is loading. Please wait.

What is object-orientation? We have been programming in Java - an OO language. What does that mean?

Similar presentations


Presentation on theme: "What is object-orientation? We have been programming in Java - an OO language. What does that mean?"— Presentation transcript:

1 What is object-orientation? We have been programming in Java - an OO language. What does that mean?

2 The main aspects of OO Abstraction by data –Break up the problem by the things in it - these are objects which are defined by classes Information Hiding and Encapsulation –Make all the details private (so they could be changed) and just ‘publish’ the public interface (typically the method signatures) Inheritance and polymorphism –Exploit the fact that you can reuse code by noticing that some kinds of objects are ‘special- kinds’ of others

3 Simple, non-OOP programs may be one "long" list of statements (or commands). More complex programs will often group smaller sections of these statements into functions or procedures each of which might perform a particular task. …. As programs grow in size, allowing any function to modify any piece of data means that bugs can have wide-reaching effects. In contrast, the object-oriented approach encourages the programmer to place data where it is not directly accessible by the rest of the program. Instead, the data is accessed by calling specially written functions, methods, which are either bundled in with the data or inherited (GETS and SETS) An object-oriented program will usually contain different types of objects, each type corresponding to a particular kind of complex data to be managed or perhaps to a real-world object or concept such as a bank account, a hockey player, or a bulldozer. The common structure and behaviour is defined in classes. A program might well contain multiple copies of each type of object, one for each of the real-world objects the program is dealing with. For instance, there could be one bank account object for each real-world account at a particular bank. Each bank account object would be alike in the methods it offers for manipulating or reading its data, but the data inside each object would differ reflecting the different history of each account. Objects can be thought of as wrapping their data within a set of functions designed to ensure that the data are used appropriately, and to assist in that use. --Wikipedia

4 Language families Assembly - very close to the machine (different on different machines) Functional - emphasizes the application of functions, and dealing with the results (Haskell is functional) Procedural - based on the actions that take place (procedure calls) that change the ‘state’ (that is sort of what we did with BJBeetle in code pad) Object-oriented - data and actions are bundled up together - the details of the data are hidden (private) just the available actions are public.

5 What languages will you learn on your course? CS15020 – XHTML, and javascript CS more java CS21120 data structures (queues, stacks, graphs … USING java) CS25010 php (moving towards OO but mainly procedural) CS25210 – html 5 CS assembler CS C - procedural CS C++ - OO –contrasting with C and java SE31520 Ruby - OO AI? – possibly lisp or prolog – functiona l Not sure why I am telling you this

6 Review for test in assignment directory Look at last year’s (note how the test covers the aspects of OO) Also see 5-3 slides for useful bits of ArrayList code Does include inheritance Does include declaring arrays (not complex code with them) Special provision? See Dave Smith This is a good review for final exam 6

7 Test is in A12 Huw Owen!!!! 5-6pm Thursday Dec 5 th No lectures on Friday (I will not be at 2pm workshop either but demonstrators will) Assignment due next Monday I will hand back test next Monday at 5pm


Download ppt "What is object-orientation? We have been programming in Java - an OO language. What does that mean?"

Similar presentations


Ads by Google