day2 - COP 3503 Computer Science II CLASS NOTES DAY #2...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3503 – Computer Science II CLASS NOTES DAY #2 INTRODUCTION Problem-Solving Techniques 1. Understand the problem completely. 2. Divide the problem into manageable pieces (divide and conquer) 3. Create solutions 4. Consider alternative solutions and refine the one selected 5. Implement the solution 6. Test and fix the solution Polymorphism (a general definition – having many forms) Creating a general solution for a class of problems which may be further specified to solve particular instances of the problem. Syntax A set of rules of a programming language that dictates the legal form of a program Semantics Describes the meaning of the program statements Day 2 - 1 Example: Class of problem: addition Polymorphic solution: counting Specific problem #1: 3 + 1 Specific solution for #1: counting on your left hand Another specific solution for #1: counting on your right hand Specific problem #2: 3 + 4 Specific solution for #2: counting on both hands Specific problem #3: 10 + 7 Specific solution for #3: counting on fingers and toes
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Compile-Time Errors Errors in syntax that can be caught by the compiler. These can be fatal or non- fatal. A fatal syntax error will halt compilation at the point of the fatal error. A non-fatal error will allow compilation to continue (although sometimes not correctly). Run-Time Error Errors in semantics. This causes your program to blowup. Logical Errors Errors in semantics which do not cause a run-time error but produce erroneous results. Encapsulation A form of information hiding Keeping data and non-essential methods private. Public methods are provided to allow user interaction. Obscures or hides non-essential details and methods. Objects are encapsulated. The rest of the system interacts with an object only through a well-defined set of services that it provides. Abstraction Generalization. Allows for selective examination of parts of a problem. Hides details. Day 2 - 2 Example: consider the sentence: “No fruit flies like a banana.” Syntax is: qualifier / noun phrase / verb / noun phrase Semantics: not( 5 x) [ fruit fly (x) and likes(x, banana)] Read as: there isn't a fruit fly that does not like bananas. OR - Syntax is: qualifier / noun / verb / adjective phrase Semantics: not( 5 x) [ fruit (x) and flies (x) flies (banana)] Read as: there isn't any fruit that flies like a banana.
Background image of page 2
Inheritance Deriving a new, generally a more specific class, from an existing class. An important reason for using inheritance is to reuse software.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 06/12/2011.

Page1 / 9

day2 - COP 3503 Computer Science II CLASS NOTES DAY #2...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online