OOSE Unit - 1
OOSE Unit - 1
• Handling big projects: Big projects are not done in a couple of days, and they need lots of patience,
planning, and management. And to invest six and seven months of any company, it requires heaps of
planning, direction, testing, and maintenance. No one can say that he has given four months of a company to
the task, and the project is still in its first stage. Because the company has provided many resources to the
plan and it should be completed. So to handle a big project without any problem, the company has to go for a
software engineering method.
• Reliable software: Software should be secure, means if you have delivered the software, then it should work
for at least its given time or subscription. And if any bugs come in the software, the company is responsible
for solving all these bugs. Because in software engineering, testing and maintenance are given, so there is no
worry of its reliability.
• Effectiveness: Effectiveness comes if anything has made according to the standards. Software standards are
the big target of companies to make it more effective. So Software becomes more effective in the act with the
help of software engineering.
Principles of Software Engineering
• The principle of simplicity states that codes should be as simple as possible without a complicated structure, otherwise debugging
and maintenance might be more difficult. Moreover, another programmer will have a harder time understanding the code logic,
which will entail more time and effort. Do you want to add that complexity? When coding your next big project, make sure you
write simple and easily comprehensible code.
It’s best if your methods are small, not exceeding 40-50 lines.
All the crucial/critical methods should have a commented doc for better understanding for other dev.
Your project has a lot of conditions, right? Break up the codes into smaller blocks as you go.
If possible, use simple constructions that solve the problem without a lot of branching, deep nesting, or complex class structures.
Principles of Software Engineering
• In a nutshell, the principle of DRY states that we shouldn’t repeat the same thing too many times in too many places. In
software systems, it aims to reduce repetitive code and effort. Developers unknowingly re-write code repeatedly. When
writing your code, don’t copy-paste the same code repeatedly. If you don’t, then you’ll need to keep them in sync; any
change in code at one place will need to be done at other places. It will take extra time, effort, and attention (which isn’t
always easy).
• Make sure not only that your code is error-free, but that it is free of duplicate lines.
• If a piece of code appears more than twice in the codebase, it should be moved to a separate function.
• You should create a separate method even if you find that it is repeated a second time.
• As a bonus, automate any manual processes you can in order to keep the code lean.
Principles of Software Engineering
When you write classes or functions that are dedicated to a single functionality, it becomes easier to
understand, maintain, and modify your code.
If you want to modify the functionality of the system, you would know the exact DRY location where you
have to modify the code.
It makes the code more organized and readable. It also makes reusing the code easier.
Principles of Software Engineering
• O – OCP (Open Closed Principle): In software development, we work in phases. As a team, we implement a bunch
of functionalities, test them, and then deliver them to the users. We then move on to implementing the next set of
functionalities. When it comes to developing new functionality, the last thing we want to do is to change the existing
functionality, which has been tested and is working. Therefore, we try to add new functionality on top of existing
ones.
• This idea is facilitated by the Open-Closed principle. According to it, our functions, classes, and modules should be
designed in such a way that they’re open for extension, but closed for modification.
Open for Extension: New functionality can be added to classes and modules without breaking the existing code.
Composition and inheritance can be used to accomplish this.
Closed for Modification: It’s ideal not to make changes that break current functionality, as doing so would require
refactoring a lot of existing code and writing several tests to ensure the changes work.
Principles of Software Engineering
• L – LSP (Liskov Substitution Principle): According to the Liskov Substitution Principle, all child/derived
classes should be replaceable for their parent/base classes without affecting or breaking the program’s
correctness. Thus, objects in your subclass (derived/child class) should behave similarly to objects in your
superclass (parent/base class). Therefore, you should use inheritance carefully in your projects. While
inheritance can be beneficial, it is advisable to use it moderately and contextually. Before you can perform
inheritance, you have to consider the postconditions and preconditions of the class.