Abstract


  • Each type has a set of Operation associated with it

Benefits of Explicit Datatype

  1. Save Main Memory
  2. Generally speeds up program, refer to this video for more details. However, use it with caution, refer to the block below for more information

Primitive Datatype

  • Also known as Built-in Datatype
  • Great performance since there isn’t much abstraction like Custom Datatype

Custom Datatype

Java Value Comparsion

We can’t use == to compare OOP Object, because == compares the value holding by the variable. However, variables are only holding the Memory Address to the OOP Object. So if we want to compare the value of OOP Object, we need to use the equals() method

Struct


  • Allows us to group a set of data to form our own Datatype. Refer to Struct in GO to see how struct is implemented and used in Go

Rust


Rust Scalar Type

Rust Compound Type

Terminologies


Statically Typed

  • The Datatype must be known during Compilation, either by explicitly define the datatype or assign a value to the variable, so the language is able to infer

Infer

Only infer when the value assigned shows the datatype, for example a := "thisIsStr", always specify type when it isn’t obvious like var a := foo()

Safer codes and more informative coding experience

Compiler has more information to do more checks on the codes and enforce certain standards. Plus better code competition when coding. Refer to this video for more more details and example.

Strongly Typed

  • We can’t add 2 variables of the different Datatype together, languages like Node.js aren’t strongly typed