Video Script
Video Script
Presenter: "Hello I’m Sanjeev Kumar Shrestha and my UoB Registration Number is
2146514. Today, I’m going to explore the project, focusing on four key software
themes: software design principles (OOP), event-driven programming, interoperability,
and virtual identity."
Presenter: " Let's start with a short demonstration of the game. Here's my game UI.
As you can see, it's a straightforward and engaging interface. Users can login or
register if don’t have login credentials. Now I am creating Sanjeev as a username and
password and login to the game portal. The main menu provides options to start a
new game with three difficulty levels with a timer and without a timer where players
can enjoy the game with challenges. When Enable Timer is checked Timer difficulty is
increased and Timer will have low amount of time. 3 minutes for Easy, 2 minutes for
Medium and 1 minute for Hard, I am choosing Easy with timer. Lives system where
players have 9 attempts to answer. Players lose a life for each incorrect answer. The
game also includes timeout-based events, such as the countdown timer in the game
and if the timer runs out, the game will be over. Also, games have Leaderboard which
shows the user highest score with difficulty level achieved as score history and current
score board."
Presenter: "Now, let’s talk about the project and how it runs. CrunchyBanana is
structured using the three-tier architecture, which includes the database (MySQL), the
server (Node.js), and the client (React TypeScript)."
// server/server.ts
app.use(cors({
credentials: true,
}));
// server/server.ts
app.use('/api/auth', auth);
Page | 1
app.use('/api/user', users);
Presenter: "Also From lines 32 to 42, I’ve defined various endpoints or routes to
handle different HTTP requests, such as authentication, user management, and game
records."
Presenter: "Now let’s see On the client side, in App.tsx, I manage page loading
states using the isLoading state. If the user is already logged in and their session
hasn't expired, they’re redirected to the dashboard. Otherwise, they’re taken to the
Authpage where user need to provide credentials username and password or register."
// client/src/App.tsx
if (isLoading) {
return <div>Loading...</div>;
if (user) {
Presenter: "Now, let’s dive deeper into the four main themes, starting with software
design principles (OOP). My project is divided into modules like models, views,
controllers, services, and hooks, making it highly modular and maintainable."
Page | 2
OOP
[Server directory: userController.ts]
// server/controllers/userController.ts
// Registration logic...
});
// server/controllers/userController.ts
// Login logic...
});
Another example, In this code, I can see an example of the Single Responsibility
Principle (SRP) in action.
// ...
Here, I have a single function SignUpForm that is responsible for rendering the sign-
up form and handling its submission. This follows the SRP principle, which states that
a function should have only one reason to change.
Line 5 and 8
Another principle I can see here is the Don't Repeat Yourself (DRY) principle. I’m using
React hooks like useState and useRef to manage state and references, which helps
us avoid duplicating code.
Presenter: "Here On lines 12, I’m defining a function handleOnSubmit that will be
called when the form is submitted. This function will handle the submission event and
perform the necessary actions. "
Client/src/components/Timer.tsx
In the Timer component, I have a timer that triggers an event every second:
useEffect(() => {
}, 1000);
}, []);
Page | 4
INTEROPERABILITY
[Scene switches back to presenter]
Client/src/services/apiClinet.ts
// client/src/services/apiClient.ts
baseURL: 'http://localhost:3000/api',
withCredentials: true,
});
Presenter: "Lines 4-9 set up my API client to handle HTTP requests with the correct
parameters."
Another example
Here, I’m importing React hooks and a custom hook useSignUp from another file.
This shows how React and TypeScript can work together to provide a robust and
maintainable codebase.
Line 42 SignupPage
Page | 5
VIRTUAL IDENTITY
[Scene switches back to presenter]
Presenter: "Finally, let's discuss virtual identity. I’ve used session cookies to maintain
user identity across multiple requests, ensuring a consistent and secure user
experience."
Presenter: "In server.ts, lines 25-28, I’ve managed session cookies to keep users
authenticated across different parts of the application."
// server/server.ts
app.use(cookieParser());
Presenter: "These lines handle the session cookies, ensuring that each user remains
logged in during their session."
// client/src/hooks/useSignin.ts
setLoading(true);
setLoading(false);
return response.data;
};
};
Presenter: "Lines 4-34 in useSignin.ts show how it handle user sign-in and manage
their session."
Page | 6
SignupPage.tsx Line 17 - 24
Another example In this code, I can see an example of virtual identity in the way it is
handling user input and validation.
if (!/^[A-Za-z]+\s[A-Za-z]+$/.test(fullName)) {
return;
Here, I’m using references to access user input values and performing validation on
those values. This shows how my code is managing user identity and data.
Presenter: "In summary, I've shown how the four themes of software design
principles, interoperability, event-driven programming, and virtual identity are
reflected in this project. By following software design principles, I can write
maintainable and efficient code. Interoperability allows us to work with different
systems and components seamlessly. Event-driven programming helps us handle user
interactions and drive the flow of my program. And finally, virtual identity helps us
manage user data and identity effectively.
Thanks for watching, and I hope this video has helped you understand these
important themes in software design!"
Page | 7