Sequential vs Procedural languages

  • Sequential languages executes code line by line
  • Procedural languages are Sequential languages that support procedures/functions

OOP | Procedural vs Object Oriented languages

source — https://m.facebook.com/Studytonight/photos/pcb.2729007120531357/2729007027198033/?type=3&source=48&locale2=pl_PL&__tn__=EH-R
//Procedural 
int main(){
String animal_name = "Zebra";
int animal_id = 123;
String animal_sound = "bow"
System.out.println(animal_name);
System.out.println(animal_id);
System.out.println(animal_sound);
}

Class : represents a real work entity.

//OOP

class Animal {
String name; // fields/attributes/properties
int id;
String sound;

public Animal(String name, int id, String sound){
this.name = name;
this.id = id;
this.sound = sound;
}

public String getName(){ // behaviours
return this.sound;
}
}

int main(){
Animal zerba = new Animal("zebra", 123, "bow"); //object

}

Method vs Functional Procedure

  • Method is basically the function in the context of a class
  • for java [object oriented language]— methods and procedure can be same.

Fields + Methods?

  • Fields + Methods are known as Members of a class

State

  • The value of every field of a class at a particular time is known as the state of the class

Favor interfaces >> Inheritance

Polymorphism

  • When we can assign an object of child class to parent class

TODO

  • why web apps does not have main method?
  • Procedural vs Functional languages
  • Object Oriented vs Functional languages

--

--