0% found this document useful (0 votes)
19 views

Low Level Design Part

Low Level Design AZ

Uploaded by

millon.madhur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Low Level Design Part

Low Level Design AZ

Uploaded by

millon.madhur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Low Level Design (LLD)

Part 1
What is LLD?
● Component Level Design Process
● Provides internal logic of software being developed
● Defines the class diagram that has attributes and methods, defining
relationships between them, etc.
Fundamentals of LLD
Fundamentals of LLD

OOP
Object-Oriented Programming
Course Structure

Week 1 Foundational OOP

Week 2 Practical OOP

Week 3 Advance Concepts of OOP

Week 4 LLD Basic Principles

Week 5 Design Patterns

Week 6 How to approach LLD problems?

Week 7 LLD FAQs

Week 8 LLD FAQs


What is OOP?
Object-Oriented Programming (OOP) is a fundamental concept in software
development that revolves around the concept of Classes and Objects.
Classes and Objects

int main() {

int a;

....

return 0;

}
Classes and Objects

32-bit integer value


int main() {

int a;

....

return 0;

}
Classes and Objects

class Person {
public:
int age;
string name;
string address;
};
int main() {
int a;
Person p1, p2;
....
return 0;
}
Classes and Objects

class Person { Custom defined.


public:
int age;
string name;
string address;
};
int main() {
int a;
Person p1, p2;
....
return 0;
}
Classes and Objects

class Person { Custom defined.


public:
int age;
string name;
string address;
};
int main() {
int a; Non-primitive data-type
Person p1, p2;
....
return 0;
}
Classes and Objects

class Person { Custom defined.


public:
int age;
string name;
string address;
};
int main() {
int a; Non-primitive data-type
Person p1, p2;
....
return 0;
}
Objects
Classes and Objects

class Person { int main() {


public:
int GetName() { Person p1;
return name; p1.SetName(“abc”);
}
void SetName(string name) { cout << p1.GetName();
name_ = name;
}
return 0;
... }
private:
int age_;
string name_;
string address_;

};
Classes and Objects

class Person { int main() {


public:
int GetName() { Person p1;
return name; p1.SetName(“abc”);
}
void SetName(string name) { cout << p1.GetName();
name_ = name;
}
return 0;
... }
private:
int age_;
string name_;
string address_;
Class members are
};
accessed by (.)
operator
Classes and Objects

class Person { int main() {


public:
int GetName() { Person p1;
return name; p1.SetName(“abc”);
}
void SetName(string name) { cout << p1.GetName();
name_ = name;
}
... p1.age_ = 25;
private:
int age_; return 0;
string name_;
string address_; }
};
Classes and Objects

class Person { int main() {


public:
int GetName() { Person p1;
return name; p1.SetName(“abc”);
}
void SetName(string name) { cout << p1.GetName();
name_ = name;
}
... p1.age_ = 25;
private:
int age_; return 0;
string name_;
string address_; }
Won’t compile
};
The public members of a class can be accessed from
Classes and Objects anywhere in the program using the direct member
access operator (.) with the object of that class.

class Person { int main() {


public:
int GetName() { Person p1;
return name; p1.SetName(“abc”);
}
void SetName(string name) { cout << p1.GetName();
name_ = name;
}
... p1.age_ = 25;
private:
int age_; return 0;
string name_;
string address_; }
Won’t compile
};
The public members of a class can be accessed from
Classes and Objects anywhere in the program using the direct member
access operator (.) with the object of that class.

class Person { int main() {


public:
int GetName() { Person p1;
return name; p1.SetName(“abc”);
}
void SetName(string name) { cout << p1.GetName();
name_ = name;
}
... p1.age_ = 25;
can be
private: accessed
int age_; here
return 0;
string name_;
string address_; }
Won’t compile
};
The private members are not accessible outside the class; they can be
accessed only through member functions of the class.
Class Initialization
Class Initialization
Constructors

A constructor is a special member function that is automatically called after a


object is created.
class Person {
public: Constructor
Person(int age, string name, string address) {
age_ = age;
name_ = name;
address_ = address;
}
...

private:
int age_;
string name_;
string address_;

};
Class Initialization
Constructors

Unlike normal member functions, constructors have specific rules for how they
must be named:

● Constructors must have the same name as the class (with the same
capitalization).
● Constructors have no return type (not even void).
Concepts Check-in
● LLD Overview
● Classes and Objects
● Public & Private members
● Constructors
● Getter & Setter Pattern
Encapsulation
● Encapsulation is the integration of data and operations into a class.
● Encapsulation is hiding the functional details from the object calling it.
Encapsulation
● Encapsulation is the integration of data and operations into a class.
● Encapsulation is hiding the functional details from the object calling it.
Encapsulation
class Car { Exposed to the user
public:
void Clutch();
void Break();
void Accelerate();

private:
Engine engine_; Hidden from the user
....
};
Inheritance
Inheritance is a mechanism in which one object acquires all the properties and
behaviors of a parent object.

Inheritance represents IS-A relationship.

E.g. Employee is a Person, Engineer is a Employee, etc.


Inheritance class Employee : public Person {
public:
string job_role;
string company;
int salary;
class Person { int id;
public: };
int age;
string name;
string address;
string mobile_no;
string aadhaar_no;
};

class SoftwareEngineer : public Employee {


public:
string team;
string tech_stack;
string language_expertise;
int level;
};
Inheritance
class SoftwareEngineer {
public:
string team;
string tech_stack;
string language_expertise;
int level;

string job_role;
string company;
int salary;
int id;

int age;
string name;
string address;
string mobile_no;
string aadhaar_no;
};
What’s next?
● Polymorphism
● Abstraction
Thank You!

You might also like