Day 10 More on Encapsulation
24 Jan 2020End of Week 2!
We continued talking about encapsulation today in class. My definition from yesterday still stands as a simple way to describe it: hiding functionality behind easy to use interfaces.
But today we extended the way we think about encapsulation. Brian brought up the concept of coupling. Coupling is how classes inter-relate. We learned that an application can be tightly coupled, which means that if you change one class, you have to change all the classes that have direct knowledge of that class. An application can also be loosely coupled which means that classes only relate to each other with public methods which won’t change. The benefit here is that you can change how private methods operate within a class without the need to change the other classes in your project.
The goal is always loose coupling, but Brian taught us that real applications are always somewhere in the middle. Loosely coupled projects require keen design choices which can take a while to work through. With real deadlines, teams have to make a choice between spending time designing and spending time coding. In either case however, writing good code starts not at a computer but at a whiteboard or a piece of paper.
In class, we designed a card class and a deck class. Brian used this as a way to show us how to model objects in the real world using Java classes and how to start to think about what attributes and behaviors might be useful to put into code.
Pathway:
After class, Ben and the pathway program put on an alumni panel where we heard from four people who have already been through the program and now working in the software development industry. It was really helpful to hear success stories and get advice on how to manage our time and our health throughout the rest of the cohort. The overwhelming sentiment was that Tech Elevator builds confidence–in skills and in self.