Low Level Design Guide ?
Low Level Design Guide ?
Curated by
It is categorised in two parts:
IMPORTANT QUESTION
simple to moderately complex words that the system
administrators should be able to comprehend.
Curated by
2 What is the significance of low-level design?
Object-Oriented Object-Oriented
Language(s) Principles
Curated by
3 Explain LLD Concepts.
Curated by
Some of the well-known principles are :
YAGNI: YAGNI principle ("You Aren't Gonna Need It") is a
practice in software development which states that
features should only be added when required. As a part of
the extreme programming (XP) philosophy, YAGNI trims
away excess and inefficiency in development to facilitate
the desired increased frequency of releases.
Curated by
iii UML Diagrams: UML Stands for unified modeling language.
It is not a programming language but a tool used for
modeling, visualizing, and creating the software system.
Curated by
iv Design Patterns: Design patterns can speed up the
development process by providing tested, proven
development paradigms. Effective software design
requires considering issues that may not become visible
until later in the implementation. Reusing design patterns
helps to prevent subtle issues that can cause major
problems and improves code readability for coders and
architects familiar with the patterns.
Design
Patterns
Curated by
Creational Patterns: Class instantiation is the central
theme of these design patterns. This pattern can be
further broken down into patterns for creating classes
and patterns for creating objects. While class-creation
patterns successfully employ inheritance throughout the
instantiation process, object-creation patterns
successfully use delegation.
Tutort Benefits
Curated by
4 What is the difference between a sequence diagram
and an activity diagram?
Curated by
Abstract Factory Pattern: Abstract Factory patterns work
around a super-factory which creates other factories. This
factory is also called as factory of factories. This type of
design pattern comes under creational pattern as this
pattern provides one of the best ways to create an object.
Curated by
6 How to tackle LLD problems in interviews?
2) Gather Requirements:
List down the functionalities and features that the
component should support. Consider performance,
scalability, reliability, and other non-functional
requirements.
3) Identify Classes/Modules:
Start by breaking down the component into smaller
classes or modules. Consider the Single Responsibility
Principle (SRP) and other design principles.
Curated by
5) Handle Data:
Determine how data will be stored, retrieved, and
manipulated. This might involve database design or in-
memory data structures.
6) Define Relationships:
Identify how different classes/modules interact with each
other. Consider composition, inheritance, or other forms of
relationships.
Tutort Benefits
Curated by
8) Code:
Finally once the thoughts are structured using Class
Diagram, Use Case Diagram, and Schema Diagram (if
required), the Candidate can start writing the code.
Apply the Design Patterns, Object-Oriented Principles &
SOLID Principles wherever is possible to make the
system reusable, extensible, and maintainable. Make
sure the code is well structured and follow the clean
coding practices to make the classes and method
clean. Don't try to fit design patterns to code but check if
a given problem can be solved using any available
design pattern. Take care of the readability of code
while taking care of all of the above.
Curated by
7 Design Snake & Ladder game.
1 Understand
the problem
2 Gather Requirements:
Create a multiplayer Snake and Ladder game in such a way
that the game should take input N from the user at the start
of the game to create a board of size N x N. The board
should have some snakes and ladders placed randomly in
such a way the snake will have its head position at a higher
number than the tail and ladder will have start position at
smaller number than end position. Also, No ladder and snake
create a cycle and no snake tail position has a ladder start
position & vice versa.
Curated by
The players take their turn one after another and during their
turn, they roll the dice to get a random number and the
player has to move forward that many positions. If the player
ends up at a cell with the head of the snake, the player has
to be punished and should go down to the cell that contains
the tail of the same snake & If the player ends up at a cell
with the start position of a ladder, the player has to be
rewarded and should climb the ladder to reach the cell
which has a top position of the ladder. Initially, each player is
outside of the board (at position 0). If at any point of time,
the player has to move outside of the board (say player at
position 99 on a 100 cell board and dice rolls give 4) the
player stays at the same position.
3 Identify Classes:
Board:
This class represents the game board and contains the
layout of the snakes and ladders.
Player:
Represents a player in the game. It stores the current
position of the player on the board.
Curated by
Dice:
Simulates the rolling of a dice. It should have a method to
roll the dice and return a random number between 1 and 6.
Game:
Orchestrates the game, managing player turns,
movements, and checking for game over conditions.
Snake:
Represents a snake on the board. It has a start position
and an end position.
Ladder:
Represents a ladder on the board. It has a start position
and an end position.
Curated by
4 Define Class Interfaces/
Methods:
Board:
addSnake(Snake snake): Adds a snake to the board.
add Ladder(Ladder ladder): Adds a ladder to the board.
Player:
move(int steps):
Dice:
roll(): Returns a random number between 1 and 6.
Game:
startGame(): Starts the game loop.
endGame(): Ends the game.
playTurn(Player player):
Curated by
5 Game Flow:
Initialize the board and add snakes and ladders.
For each player's turn, roll the dice and move the
player accordingly.
Check for snakes or ladders at the new position
and adjust the player's position if needed.
Check if a player has won (reached the last
position).
6 UML: Diagrams:
PLAYER
GAME -name : str
DICE -position : int
board : Board
die : Die + move(steps : int)
players : list(Player) + get_position(): int
winner : Player + roll():int
play_turn(player: Player)
start_game()
BOARD
- size : int
- snakes : dict
- ladders : dict
+ add_snake (start: int , end: int)
+ add_ladder (start: int , end: int)
+ move(position: int): int
Curated by
7 Code:
Below is a basic Python implementation of the
Snake and Ladder game.
class Board:
def __init__(self, size):
self.size = size
self.snakes = {}
self.ladders = {}
self.snakes[start] = end
self.ladders[start] = end
if position in self.snakes:
return self.snakes[position]
return self.ladders[position]
return position
class Dice:
def roll(self):
return random.randint(1, 6)
Curated by
class Player
def __init__(self, name):
self.name = name
self.position = 1
self.position += steps
def get_position(self):
return self.position
class Game:
def __init__(self, board, dice, players):
self.board = board
self.players = players
self.winner = None
player.move(steps)
player.position = self.board.move(player.position)
if player.position == self.board.size:
self.winner = player
def start_game(self):
self.play_turn(player)
print(f"{self.winner.name} wins!")
Curated by
if __name__ == "__main__":
board = Board(100)
board.add_snake(16, 6)
board.add_snake(47, 26)
board.add_snake(49, 11)
board.add_ladder(3, 22)
board.add_ladder(5, 8)
board.add_ladder(20, 24)
# Create players
# Create game
# Start game
game.start_game()
Curated by
More LLD interview questions to practice:
1250+ Career
Transitions 350+ Hiring
CTC
Curated by
Start Your
Upskilling with us
Explore More
www.tutort.net
Watch us on Youtube Read more on Quora
Follow us on