Scala for Simpltons. Objects and Classes… Get that static garbage out of here.

  • Singleton Objects.
  • Companion Classes.
  • Abstract Classes.
  • Case Classes.
  • the “apply” method.

Singleton

Companions. Classes and Objects.

Abstract Classes

preferredName is the result of the function def preferredName, notice you do not need to call a function that has no parameters.

Traits (Bonus)

Frogs jump, Adults humans can jump, babies don't jump though, neither do lizards… are people more closely related to frogs than babies?…

Case Classes

C to the A to the S to the E

Apply Methods

NEXT TIME ON SCALA FOR SIMPLETONS…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store