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

Info icon This 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
Image of page 1

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

View Full Document Right 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.
Image of page 2
Inheritance Deriving a new, generally a more specific class, from an existing class.
Image of page 3

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern