Summary of first chapter (Head first object oriented programming)

Photo by Trent Erwin on Unsplash

Summary of first chapter (Head first object oriented programming)

The writer began the chapter with an intro to the meaning of "objectiville", so at the end of the article we will be able to know about it.

We will begin our talk with the definition of UML: A way to represent details about classes in your app. Note: name of classes always in bold at the top of the class diagram.

Benefits of UML that it makes it easy to see the big picture of the parts in your app.

A photo of an example of UML.

uml.jpg


The chapter will give us a simple app to show us the concepts with the coding, through our journey with this app we will meet a lot of problems which will be solved by the concepts the chapter contains.

-The first problem in page 6, its solution was that: it is better to use constants or enums instead of Strings to avoid misspelling and case issues.

Note: enumerated types lets you define a type name like WOOD and then a set of values that are allowed to this value, then you refer to a specific value like WOOD.COCOBOLO.

The cool thing about enums is that methods or classes that use them are protected from any values not defined in the enum. so you can't misspell or mistype an enum without getting a compiler error.

That is a tutorial about enums in java:


What is the great software? (1) Software that satisfies the customer(by good requirements and doing some analysis)+(code is open for extend and close for modification)

(2)Well designed(no duplicate code), easy to maintain and extend (by using design and principals patterns)

(3)Strive for maintinable and reusable code that we can use for years to come.

vxdzZ9YZdRV.jpg

Some another points: -Be careful to use textual description to show your problem that will help you to understand it deeply so you can solve it and represent to others easily. -Each object(class-struct) is responsible for specific task that is -> .easier to code .easy to give different developers different tasks.

Link of an article about the difference between enum and struct


Data hiding or Encapsulation: it allows you to hide the inner workings of your application's parts, but yet make it clear what each part is.

Benefits of data hiding: -good design: reveal as little as possible of data members and functions. to prevent data corruption and protect objects integrity. -reducing system complexity, so better code readability.