Unit 2- Program Design Strategies Flashcards
Top-down design vs bottom-up design
Top-down design starts with the broad vision and breaks it down into smaller, more manageable parts, while Bottom-up design starts with the small details and builds them up into a larger system.
Local scope?
Local scope in C# refers to variables or functions that are declared within a specific block, such as a method or loop.
Global scope?
Global scope, on the other hand, refers to variables or functions that are declared outside of any block or function.
These variables are only accessible within that block, and cannot be accessed outside of it. For example, if a variable is declared within a method, it can only be accessed within that method, and any attempt to access it from outside the method will result in an error.
THIS IS?
LOCAL VARIABLE/SCOPE
These variables can be accessed and modified from anywhere within the program, including within functions and blocks. ……… variables are often used to store information that needs to be shared between different parts of the program.
GLOBAL VARIABLE
Using global variables can sometimes lead to issues such as naming conflicts, where…
a variable with the same name is declared in different parts of the program, or unintended modification of variables by different parts of the program.
To avoid these issues, it is generally best practice to limit the use of global variables and instead use local variables whenever possible.
DUE TO THE NAME CONFLICTS ASSOCIATED WITH GLOBAL VARIABLES
DIFFERENCE BETWEEN LOCAL AND GLOBAL SCOPE
local scope in C# refers to variables or functions that are only accessible within a specific block, while global scope refers to variables or functions that can be accessed from anywhere within the class
PRIVATE AND PUBLIC ACCESS MODIFIERS
the private access modifier limits access to only within the class, while the public access modifier allows access from anywhere in the program.
Modularity
refers to the process of breaking down a large program into smaller, more manageable, and reusable modules or components.
Each module is designed to perform a specific task or set of tasks, and can be used independently or in combination with other modules to create a complete program.
IIST some importance of modularity within C# environment
Maintainability
Reusability
Scalability
Encapsulation
Debugging IS EASIER
Develop applications more rapidly.
Reuse OF Code
This can help to save time and effort, and also ensures consistency across projects. For example, a module that handles input validation can be reused in multiple applications, rather than having to rewrite that code for each project.
Debugging
By breaking code into smaller, more manageable modules, developers can isolate and identify problems more quickly.
Modules are typically designed to perform specific tasks, so any issues that arise can be more easily traced back to the relevant module.
Develop Applications
By breaking a large application into smaller modules, developers can work on different parts of the application simultaneously. This can help to speed up the development process, as multiple team members can work on different modules at the same time.
Main method?
This is the entry point of the program and serves as the control center. It prompts the user for input, calls other methods to handle user input and perform calculations, and displays the result to the user.