JAVA — VARIABLES

“Variables” and “Fields” are a common source of confusion since both often seem to refer to the same thing.

Things covered today:

  1. Instance Variables
  2. Class Variables
  3. Local Variables
  4. Parameters

Instance Variables — A variable that is unique to each instance of a class. AKA Non-Static Fields.

  • Example: Each Instance of the Class of Parents may have different eye color. One Instance may be black while another is blue eye color.

Class Variables — A variable that is shared among all instances of a class. AKA Static Fields or Static Member Variables. 

  • Example: Every Instance of the Class of Parents having a pair of eyes is a class variable.

WALT DISNEY

Core ideology consist of:

  1. Purpose — A goal that is never fulfilled. A guiding star.
  2. Values — It isn’t about having the best values or copying other’s values, but about being true to your own values. Values must be authentic. Doesn’t have to be unique but has to be your own. Values are non-negotiable.

walt

Walt’s Purpose: Bringing happiness to millions.

Walt’s Values: Walt was a deeply spiritual individual who held the importance of American and Family values above all else. He spent the rest of his life pursuing an ideal — that of clean wholesome family entertainment.

Innovation
o We follow a strong tradition of innovation.

Quality
o We strive to follow a high standard of excellence.
o We maintain high-quality standards across all product categories.

Community
o We create positive and inclusive ideas about families.
o We provide entertainment experiences for all generations to share.

Storytelling
o Every product tells a story.
o Timeless and engaging stories delight and inspire.

Optimism
o At The Walt Disney Company, entertainment is about hope, aspiration and positive resolutions.

Decency
o We honor and respect the trust people place in us.
o Our fun is about laughing at our experiences and ourselves.

Walt’s advice on finding your passion:

When you believe a thing, believe it all the way, implicitly and unquestionably.

We didn’t go into Disneyland with just the idea of making money. We did it in the knowledge that most of the people I talked to thought it would be a financial disaster — closed and forgotten within the first year. When we opened Disneyland a lot of people got the impression that it was a get-rich-quick-thing, but they didn’t realize that behind Disneyland was this great organization that I built here at the studio. And they all got into it and we were doing it because we loved to do it.

When you’re curious, you’ll find lots of things to do. And one thing it takes to accomplish something is Courage.

If you can dream it, you can do it.

Walt’s top 5 rules for success (simplified down from 10):

  1. Invest in knowledge. First thing Walt did when he got some money was put all his artist back in school. Set up his own art school since art school back then didn’t have what he was looking for (movement, action, reaction).
  2. Know your goals. Walt dedicated a whole room to sketching out the plan and layouts of Disney World. Everything in that room may change time and time again but the basic philosophy will stay the same — He know what his purpose and values are and what he hopes to accomplish.
  3. Try it on a small scale first. When Walt dreams of new ideas for Disneyland, it takes shape in forms of blueprints, scale models, and drawings.
  4. Experiment. Brought some kittens into the studio and let them play while the artist made sketches and collected ideas for the kitten’s story. Lead to the producing of the Academy Award Winner — Three Orphan Kittens.
  5. Daydream. Disneyland was conceived from a dream — a dream that grew into a reality.

JAVA

Credits to my tutor Lanvi

Java uses Object-Oriented Programming (OOP).

OOP is method of computer programming that involves using ‘objects’.

programmSource

Object — An object is the piece of code that let’s you create other similar piece of code without re-writing it each time. Objects must have State and Behavior.

  • Example: Parent. A parent’s State (first name, last name, age) is stored in Fields. A parent’s Behavior (going to work, going to school, sleeping) is exposed through Methods. The hiding of internal state and requiring all interactions to be performed through methods is called Data Encapsulation.

Class — A class is a piece of code that represents the blueprint of the object.

  • Example: Parent. There may be billions of other parents in existence. Each parent was built from the same set of blueprints and therefore contains the same components. We say that your parent is an Instance of the class of objects known as parents.

Inheritance — An inheritance let’s you write a method only once and have n different classes use it as long as they inherit it from the parent class.

  • Example: Child. A child is a subclass and it inherits all the members (fields, methods, and nested classes) from its superclass. A subclass uses the keyword extends. Constructors are not members, so they are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass.

Constructors – Constructors are the entry point, the same parameters, that each class instances need to have. The parameters has to be the same but the values may be different.

  • Example: Parent (String name). One parent can be name “John” and another parent would need to have a name too but it could be “Jane.”

Interface — Interfaces form a contract between the class and the outside world. Implementing an interface allows a class to become more formal about the behavior it promises to provide. An interface is just a group of related methods with empty bodies. A class forms a contract with an interface with the keyword implements.

  • Example: “Human” has methods with empty bodies (name, gender, age) which get filled in when the class parent implements it. This makes coding more flexible because say if I want to create another parent class you can just implement the interface again and fill in different body for the methods.

Package — A Package is a namespace that organizes a set of related classes and interfaces. You can think of packages as being similar to different folders on your computer.

  • Example: java.applet, java.awt, java.awt.color.

Thanks,

Jeffrey

WAKING UP

My first post! If you want to wake up early and have trouble doing so, I encourage you to hear my tip —

Recharge your smartphone in the bathroom.

This goes for any other kind of technology: laptop, TV, etc. Why? Because not only does it stop you from checking your smartphone at night, it also forces you to get up in the morning to turn off the alarm. It also prevents cognitive stimulation and prevents the delay of melatonin.

According to WebMD, we experience cognitive stimulation we use our smartphones which is not what we want before we sleep. Also the blue light from our device delays our body from creating melatonin, the hormones that makes us sleepy.

Now the important question. Why do you want to wake up early?

According to Biologist Christoph Randler, early risers tend to be more proactive —

[Randler] surveyed 367 university students, asking them when they were most energetic and willing to change a situation. It was the morning people who were more likely to agree with statements such as “I feel in charge of making things happen” and “I spend time identifying long-range goals for myself.”

Some examples of success people who are early risers:

url

Apple CEO Tim Cook can be found in the gym by 5 a.m.

Tim Cook, Apple’s CEO, starts sending emails around 4:30 a.m., according to Gawker’s Ryan Tate. After that he works out. He’s boasted about being the first in the office and the last out.

Steve Jobs was also an early riser, starting his days around 6:00.Maybe Tim Cook fashioned his early morning routine after his former boss, Steve Jobs.

Jobs told Time back in 1999 about how he started his days: “I’ll wake up sixish and work a little before the kids get up. Then we’ll have a little food, finish up some homework, and see them off to school. If I’m lucky I’ll work at home for another hour, but oftentimes I’ll have to come in. I usually get [to Apple] about nine. Eight or nine. Having worked about an hour and a half or two hours at home.”

Q:  What motivates you every morning to get up?

Thanks,

Jeffrey