Choosing a Programming Language



https://dev.to/drminnaar/choosing-a-programming-language-493h

Advertisements

Android Architecture Simplified with Kotlin

I hate Android Architecture since it is based on OO Java, Kotlin is FP cousin of Java, hopefully it could simplify the Android Architecture by getting rid of the complex OO architecture. Here Antonio attempts to simplify it with more terse Kotlin codes, albeit still in the OO architecture spirit.

https://antonioleiva.com/architecture-components-kotlin/

Java Family

Year Ver Code Name Description
1995 1.0 Java Applets
1977 1.1 Java Event, Beans, Internationalization
Dec 1978 1.2 Java 2 J2SE, J2EE, J2ME, Java Card
2000 1.3 Java 2 J2SE 1.3
2002 1.4 Java 2 J2SE 1.4
2004 1.5 Java 5 J2SE 1.5
Nov 2006 6 Java 6 Open-Source Java SE 6. “Multithreading” by Doug Lea
May 2007 OpenJDK free software
2010 Oracle acquired Sun
Jul 2011 7 Java 7 “Dolphin”
Mar 2014 8 Java 8 Lambda Function

Javac: Java Compiler

Java Distributions:

1. JDK (Java Developer Kit )
◇JRE & Javac & tools

2. JRE (Java Runtime Environment)
◇ JVM & core class libraries
◇ Windows / Mac / Linux

Java is Object-Oriented Programming (OOP):
1. Class
public class Employee {

public int age;
public double salary;

public Employee () { [<– constructor with no arg]
}

public Employee (int ageValue, double salaryValue) { [<- constructor with args]

age = ageValue;
salary = salaryValue;

}
}

2. Construct = create / instantiate objects from the Class template.

3. Constructor : used to construct an object
◇ Every class must have at least 1 constructor (default add one by compiler)
◇ Same name as the Class
◇ It is like a Method without return value.

3. Method
returnType methodName (args)

returnType : primitive | object | void

void : (method returns nothing)

Examples:
♡ Primitive : int

int add (int a, int b)

♡ Object : Address

Address getAddress ()

◇ Void
(Special Method)

public static void main (String [] args)

static members are not tied to class instances. The method main acts as the entry point to a class, is static because it must be called before any object is created (instantiated).

Naming Conventions:
◇ Class: Employee , Address
◇ Fields: firstName, maxAge, blockNumber…
◇ Method: getAddress ()