17. Abstract Class - CS2030S Programming Methodology II
Recall that the concept of abstraction involves hiding away unnecessary complexity and details so that programmers do not have to bogged down with the nitty-gritty. When we code, we should, as much as possible, try to work with the higher-level abstraction, rather than the detailed version. Following this principle would allow us to write code that is general and extensible, by taking full advantage of inheritance and polymorphism. Take the following example which you have seen, The function above is very general. We do not assume and do not need to know, about the details of the items being stored or search. All we required is that the equals method compared if two objects are equal. In contrast, someone whose mind focuses on finding a circle, might write something like this: Now, let's consider the following function, which finds the largest area among the circles in a given array: findLargest suffers from the same specificity as the version 0.3 of contains. It only works for Circle
Unit 17: Abstract Class After this lecture, students should: be familiar with the concept of an abstract class know the use of the Java keyword abstract and the constraints that come with it understand the usefulness of defining and using an abstract class understand what makes a class concrete High-Level Abstraction Recall that the concept of abstraction involves hiding away unnecessary complexity and details so that programmers do not have to bogged down with the nitty-gritty. When we code, we should, as much as possible, try to work with the higher-level abstraction, rather than the detaile
Explore this link on the map →saved by
related reading
- 4. Encapsulation - CS2030S Programming Methodology IInus-cs2030s.github.io
- 20. Casting - CS2030S Programming Methodology IInus-cs2030s.github.io
- Lab 1: Simulation I - CS2030S Programming Methodology IInus-cs2030s.github.io
- 19. Wrapper Class - CS2030S Programming Methodology IInus-cs2030s.github.io
- 14. Polymorphism - CS2030S Programming Methodology IInus-cs2030s.github.io
- 21. Variance - CS2030S Programming Methodology IInus-cs2030s.github.io
- 2. Variable and Type - CS2030S Programming Methodology IInus-cs2030s.github.io
- Abstraction (computer science) - Wikipediaen.wikipedia.org
- how I think when I think about programming - alice mazalicemaz.com
- Abstractioncs.cornell.edu
- Up and Down the Ladder of Abstractionworrydream.com
- The Law of Leaky Abstractions – Joel on Softwarejoelonsoftware.com