Quick question. I’ve been reading up on abstraction and think i may understand or at least partially so. Wanted to give a quick example and run it by y’all and see if i’m on the correct path.
Abstraction is my understanding that if (A = max occupancy of a building) that tells me how many people are in the building. I don’t have to understand or at least clarify the steps needed to calculate how many people are in a building. I can just know what (A) does and use that to more simply write my code or design the structure of a program.
For Example: if I know that (a) = max occupancy of a building. I am able to abstractly understand that (A) calculates: rooms in building * max occupancy per room = max occupancy of building. Abstraction allows me to simply use (A) to get the desired end result.
So by using abstraction to find the sum of the max occupancy for two buildings I am simply using A+A in my code because that is implied and understood that i’m saying at a higher level (( rooms in building * max occupancy per room = max occupancy of building + rooms in building * max occupancy per room = max occupancy of building) = A+A)
Am I anywhere close to the mark? If so than my using a library is an example of abstraction. By using MATH for example, i’m able to do everything involved in the MATH library without actually having to sit down and write out the entire library then start doing calculations. I can just call MATH and use it immediately whether I understand the details and such. This saves me time allows me to make bigger and better programs in less time versus building every library every single time.
Thanks in advance for any help/advice/criticism. I’ve read through quite a bit but everything has been super technical so its tricky getting a mental picture in my head of what abstraction is. Hard finding a real “for dummies” explanation.