key points: Code restructuring,Importance of Code Restructuring in Software Engineering, 3 Common Scenarios that Require Code Restructuring(Software Growth and Complexity,Adopting New Technologies and Frameworks,Software Modernization Efforts), Techniques for Code Restructuring Prof:Umme Ammara Tariq
Code Re-Structuring: Code restructuring is a critical process in software engineering that includes modifying existing code to enhance its structure, organization, and efficiency while ensuring the code retains its intended functionality. Why we do? The restructuring process is often performed to address various issues such as code complexity, maintenance difficulties, poor readability, performance issues, and scalability limitations. The process makes small, targeted changes to the codebase, ensuring that each modification maintains the same functionality. Prof:Umme Ammara Tariq
Importance of Code Restructuring in Software Engineering improves its readability by applying consistent formatting, removing redundant or necessary code, and organizing it in a logical and cohesive manner. It simplifies code complexity by employing design patterns, refactoring techniques, and appropriate abstractions. the code to be updated, new features and functionality can be added without causing widespread impact or introducing unintended consequences. Prof:Umme Ammara Tariq
Understanding of code restructuring: Code restructuring allows developers to reevaluate the system’s architecture, identify areas of improvement, and apply design patterns and principles to enhance the overall structure. This fosters collaboration, reduces conflicts during code integration, and improves team productivity. Prof:Umme Ammara Tariq
3 Common Scenarios that Require Code Restructuring: 1. Software Growth and Complexity As software systems evolve and are updated with updated features, they grow in size and complexity. This can lead to changes and additions to the codebase that become difficult to monitor and comprehend. 2. Adopting New Technologies and Frameworks When software teams adopt updated technologies, programming languages, or frameworks, the existing codebase may not align with the updated standards and best practices of the adopted technology Prof:Umme Ammara Tariq
3. Software Modernization Efforts In the process of modernizing software, legacy systems are upgraded to modern architectures. Legacy systems may have outdated code, use obsolete technologies, and lack modern features. Code restructuring plays a critical role in modernization efforts by transforming the legacy code into a modern efficient, and maintainable form. Prof:Umme Ammara Tariq
4 Techniques for Code Restructuring 1. Refactoring: Extracting methods: Breaking down long and complex methods into smaller, reusable units to enhance code readability and modularity. Variable renaming: Choosing meaningful and descriptive names for variables, functions, and classes to improve code clarity. Simplifying complex expressions: Breaking down complex expressions into simpler ones to improve readability and maintainability. Prof:Umme Ammara Tariq
2.Decomposition: Decomposition involves breaking down complex codebases into smaller components, such as modules, packages, classes, and interfaces. The technique enhances code organization, maintainability, and reusability. By separating concerns into distinct components, developers can work on individual parts of the codebase independently, reducing code dependencies and improving collaboration among team members. Prof:Umme Ammara Tariq
3. Consolidations: Consolidations aim to reduce code duplication and eliminate code smells. Code duplication often leads to maintenance issues and increases bug introduction chances. Techniques for consolidation include extracting common code blocks into reusable functions or libraries, streamlining conditional statements, and removing maintainability, and overall software quality. Prof:Umme Ammara Tariq
4. Optimization Optimization techniques emphasize improving codebase performance and efficiency. The process involves analyzing and optimizing algorithms, leveraging appropriate data structures, and implementing caching mechanisms where applicable. Prof:Umme Ammara Tariq
Migration to Object Oriented platforms Moving from procedural programming to object oriented programing. Procedural programming. Object oriented Programming. Prof:Umme Ammara Tariq
Procedural programming: Procedural programming follows a top-down approach. Procedural Programming divides the program into small programs and refers to them as functions. Procedural programming is less secure as compare to OOPs. C, BASIC, COBOL, Pascal, etc. are the examples POP languages. Prof:Umme Ammara Tariq
Object Oriented Programming Object-oriented programming follows a bottom-up approach. There is no access specifier in procedural programming. Object-oriented programming has access specifiers like private, public, protected, etc. Object Oriented Programming divides the program into small parts and refers to them as objects. C++, C#, Java, Python, etc. are the examples of OOP languages. Prof:Umme Ammara Tariq
Why we migrated from procedural language to OOP: In procedural programming we face Lack of Modularity. Limited Code Reusability Difficulty in Managing State Poor Scalability Limited Support for Abstraction Difficulty in Code Maintenance Reduced Flexibility Prof:Umme Ammara Tariq
OOP Modularity and Reusability: Advantage: OOP promotes modularity, allowing developers to break down a system into smaller, self-contained modules or classes. These modules can be reused in different parts of the application or in other projects. Prof:Umme Ammara Tariq
Prof:Umme Ammara Tariq
Encapsulation: Advantage: Encapsulation hides the internal details of an object and exposes only what is necessary. This reduces complexity and makes it easier to understand and maintain the code. Benefit: Improved code organization and maintenance. Prof:Umme Ammara Tariq
Abstraction: Advantage: Abstraction allows developers to focus on essential features of an object while ignoring unnecessary details. This simplifies the development process and enhances code readability. Benefit: Clearer, more concise code that aligns with real-world entities. Prof:Umme Ammara Tariq
Inheritance: Advantage: Inheritance enables the creation of new classes by inheriting attributes and behaviors from existing classes. This promotes code reuse and helps in building a hierarchy of classes. Benefit: Hierarchical organization of code for improved scalability and extensibility. Prof:Umme Ammara Tariq
Polymorphism: Advantage: Polymorphism allows objects to be treated as instances of their parent class, providing a level of flexibility in designing and implementing solutions. Benefit: Enhanced adaptability and the ability to work with different types of objects through a common interface. Prof:Umme Ammara Tariq
Community Support and Standardization: Advantage: Many widely used programming languages, frameworks, and libraries are built on OOP principles. Benefit: Access to a large ecosystem of resources, community support, and standardized practices. Prof:Umme Ammara Tariq