Lecture 1 Flashcards
What is structure programming
Structured programming (SP) is a technique that was devised to improve the reliability and clarity of programs.
In SP control of program flow is restricted to?
In Structured programming (SP) control of program flow is restricted to three structures, sequence, selection and iteration.
What is modular programming
Modular programming is a general programming concept that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality
What do you mean by code is easier to read for modular programming
Modular programming involves breaking down code into smaller functions, each handling a specific aspect of the overall functionality.
This approach enhances readability by organizing code into manageable units
Why moular programming?
Code is easier to read
Code is easier to test
Reusability
Easier to collaborate
What do you mean code is easier to test
Software that’s split into distinct modules is also ideal for testing.
That’s because tests can be much
stricter and more detailed when you test small functions that do less, compared to big functions that do a number of things.
Why is code more reusable in modular programming
Modularity in programming prevents redundant code by centralizing common functions or code snippets in a single source, facilitating reuse across different sections of a program.
Why is it easier to collaborate
Modular programming is essential where multiple teams need to work on different components of a program
Why do people still write spaghetti code
- Code size: Modularity can increase code size and impact performance if you can’t tree shake your dependencies
- Complexity - Sometimes complex file systems aren’t necessary and can add unnecessary overhead
- Security - Monolithic code can make it harder for people to mess with code that the original developer doesn’t want changed, hacked, or pirated
What is stepwise refinement
Stepwise Refinement is the process of breaking down a programming problem into a series of steps.
What is Object Oriented Programming
Object-Oriented Programming (OOP) is a way of writing code that focuses on creating “objects” which contain both data (like information about a person) and the functions, or actions, that can be performed with that data (like making the person walk or talk).
It helps organize code better and makes it easier to work with, especially in larger projects.
What is a class?
In programming, a class is like a blueprint or a template for creating objects.
It defines the properties (attributes or variables) and behaviors (methods or functions) that all objects of that class will have.
What are attributes
Attributes are the individual things that differentiate one object from another and determine the appearance, state, or other qualities of that object.
What is a behaviour of a class
In programming, a behavior refers to the actions or functions that an object can perform. In the context of object-oriented programming (OOP), behaviors are typically defined as methods within a class
What is a constructor
A constructor is a special member function in a class that is automatically called when an object of that class is created.