Week 10

This week's reading material covered a lot of the basic concepts of Java and OOP. While none of this is new to me as I have used Java quite a bit, I found reading the book a great refresher.

Some of the key takeaways from the reading:

? Static methods can be used without calling objects whereas static variables belong to the whole class and can be used to share information between objects of the class.

? Abstraction and Encapsulation are key features of OOP. Abstraction hides the implementation details from the user and they are only able to know what the object, class or method does instead of how it does it. Encapsulation is java wraps data and methods together as a single unit and hides the data from other classes and users. With encapsulation, data in variables of the class is protected using the private access modifier and can only be accessed or modified by using accessor or mutator methods, this is also known as data hiding.

? In 5.2, the author talks about how variables other than primitives behave differently because other variables of classes reference memory location and not directly an object. For example, a, b are integer arrays such that int[] a = [1,2,3,4] and int[] b = [2,4,6]. Now if we set a = b then we are telling a to reference the same memory location as b. Thus a = [2,4,6]. Then if we set a[0] = 5,  this would change both a and b to be a = [5,4,6] and b = [5,4,6].

? The ultimate takeaway is that everything in OOP languages is an object.

I have not used a non-object-oriented programming language before but language but I have heard and read about them. Languages such as BASIC, C, and Fortran are not object-oriented. Additionally, I have not used OOP extensively outside of class before but recently I have started to practice OOP. Lastly, I have used UML diagrams for class and I have found them to be extremely helpful in understanding the flow and inheritance of classes and programs.