Computing Fundamentals PROG8060 Developing Quality Applications Spring 2019 Baljeet S. Bilkhu [email protected]
Today’s Agenda… From the Course Outline: 1.0 Background and relevance of Computing Systems in Software Development 1.1 Define the concept of problem solving within the context of Software Development and apply abstraction techniques through encapsulation in the pursuit of developing a solution strategy. 1.2 Differentiate between the various methodologies or activities in developing computer software with a focus on the Agile Methodology. Agile – an Introduction Project Work – Overview and Expectations
What is a System? In the book “Software Design”, Ian Sommerville writes that “a system is a purposeful collection of interrelated components that work together to achieve some objective”* Each of these components that make up the overall system, can in fact, be a system on to themselves (hence, they maybe known as sub-systems) E.g. the navigational equipment of an airplane A system must have some purpose or objective. * D. Budgen , Software Design, 2nd ed., Addison-Wesley, 2003.
What is a System? ( cont …) Systems may be very simple – such as a remote car key / starter It is very predictable – it has a function to start the car and to allow the driver access into it. …or they can be complex – such as the car itself Reasonably predictable, but not fully understood Similarly, with software systems, they can be made very simple and thus predictable or they can be complex and not well understood – hence we have defects / bugs in the code.
Computer Systems / Components Computers generally consist of CPU(s), memory (RAM, ROM, Disk), and input / output devices and can be organized as follows: CPU MEMORY Control Unit Input Output
Computer Systems / Components For software developers (and testers), the most important level is the Macro Architecture Level – as this is where instructions, registers, addressing, memory, I/O are specified.
Compilers Usually, developers create computer programs / applications using high-level languages such as C, C++, C#, Java, etc … By using such high-level languages, we (as humans) can understand what is the program is about and what it is doing The CPU won’t be able to understand such a language – as such, we’ll need to convert this code into a language (machine code) that CAN be interpreted by the CPU
Compilers ( cont …) Translation must be done for each Macro Architecture Level This translation is done by software known as “Compilers” Usually, there are two ways in which this translation can be done: Interpretation – translating the source code one statement at a time, which will then be executed, going back to translate another statement and then executing it and so on… Compilation – done by a compiler to create an executable file
Compilers vs. Interpreters Compilers makes the conversion just once whereas an Interpreter converts the code every time it is run Interpretation is often a lot slower as a result because the Interpreter must analyze each line every time Access to variables is also slower in an Interpreter as mapping of identifiers to memory must be done repeatedly.
Operating Systems Operating Systems (OS) perform the management of the overall computer system Such tasks can include allocation of resources (CPU, Memory, Disk, Network, I/O) amongst all of the applications running on the computer
Operating Systems Operating Systems (OS) perform the management of the overall computer system Such tasks can include allocation of resources (CPU, Memory, Disk, Network, I/O) amongst all of the applications running on the computer Operating Systems are generally a combination of software and firmware that manages the execution of software They also provide resource allocation, job control, I/O and file management
Operating Systems ( cont …) Operating Systems essentially manage the hardware resources that are used by the software through what is known as abstraction Abstraction is a way in which the OS hides the complexity in managing the underlying hardware for the software – this way, the software (regardless of the developer) can make standardized calls and procedures to the software without caring about the details of the hardware (regardless of the manufacturer).
Operating Systems ( cont …) Each OS (such as Windows, Linux, macOS , Android, BlackBerry, iOS, etc…) will significantly differ due to the associated hardware Having said this, each OS will also perform a similar set of high-level functions: CPU Management Memory Management Disk Management Network Management Input / Output Management Security Management.
Problem Solving
Fundamentals of Problem Solving A problem is anything (such as a matter or situation) that doesn’t currently have a solution and is currently requiring to be dealt with There are many ways in which problems can be solved. For instance, a problem may exist in getting from point A to point B:
Fundamentals of Problem Solving ( cont …) When solving engineering problems, the following basis usually needs to be considered: Formulate what the real problem is Analyze the problem Develop a solution strategy
Formulating the Problem This is essentially expressing the problem in a way that a solution can be developed (easily) for it. Can include restating what the Problem Statement is really Determining the cause / effects of the problem Revising the Problem Statement Analyzing the Current and Desired states
Analyzing the Problem Once the problem statement is available and has been narrowed down, the next step is to actually analyze the problem. Understanding what is the Root Cause of the Problem IF this is not done, you may not be able to properly solve the problem (hence, putting a Band-Aid type solution)
Developing a Solution Strategy Once the problem has been analyzed, then and only then can one start to develop a plan on how to solve the problem May involve evaluating several solutions and picking the best solution under the circumstances Look at the pros and cons of each intended solution and pick the one that has the greatest differential (pros – cons)
Example of Problem Solving - 1 A woman fired a shot from a gun at a man. The man did not die. List the possible reasons for the man not dying.
Example of Problem Solving - 2 An alien meets you and it asks you to teach it how to brush its teeth. Assume that the alien has teeth exactly like yours and is as smart as you but it needs a clear step-by-step instruction. List the steps. Be as detailed as you can.
Problem Solving in Software Engineering In Software Engineering, problems are solved using computational devices (such as computers, laptops, mobile phones, etc…) and software (applications running on these platforms / devices) Depending on the problem itself, the solution to it may warrant different tools or techniques. E.g. You won’t use an elephant gun to hunt for butterflies E.g. You generally won’t develop a solution for a BlackBerry device using iOS
Problem Solving in Software Engineering When using computers to solve problems, the computer can only do what it is told to do (i.e. what we program is what the computer will do).
Algorithms Defined as a step-by-step set of rules followed by calculations or other problem-solving operations – notably by computers Usually done using pseudo-code
Example 1 Develop an Algorithm to make buttered toast with raspberry jam
Example 2 Develop an Algorithm to make “ Aloo -Gobi” subzi
Example 3 Develop an Algorithm that reads a series of real numbers and adds them , printing the result . The series ends when the user enters the number zero .
Example 4 Develop an Algorithm for a dice game . The player bets on a number between 1 and 6 ( from the keyboard ), then the program simulates the roll of the die and informs the user whether he has won or lost via a message on the screen .
Abstraction Is a technique that is often used in problem solving – especially in software development / engineering – essentially, making relevant information visible – more so for speed and efficiency From Wikipedia : “the process of removing physical, spatial, or temporal details [2] or attributes in the study of objects or systems in order to more closely attend to other details of interest [3] ; it is also very similar in nature to the process of generalization ;”
Abstraction Example
Encapsulation The word “Encapsulation” is defined as enclosing items within a package. This package can be either a physical, tangible item – but for our purposes, we’re going to consider a “logical” package in which code is enclosed into. In dealing with OOP, encapsulation prevents access to the implementation details – sort of a security feature It is implemented using access modifiers
Access Modifiers Access Modifiers define the scope and visibility of class members The following Access Modifiers are available in C#: public private protected internal protected internal
Access Modifiers - public These types can be accessed by code in the same assembly or another assembly that references it namespace PROG8060Encapsulation { class Coordinates { public int longitude; public int latitude; } class MainClass { static void Main() { Coordinates c = new Coordinates (); // Direct access to public members: c.longitude = 43; c.latitude = 80; Console .WriteLine ( "longitude = {0}, latitude = {1}" , c.longitude , c.latitude ); Console .ReadLine (); } } // Output: longitude = 43, latitude = 80 }
Access Modifiers - private These types can only be access by code in the same class, otherwise a compile-time error will occur when trying t0 access it class Employee { private string name = " Pinkah Poondh " ; private double salary = 54452.34; public string GetName () { return name; } public double Salary { get { return salary; } } } class PrivateTest { static void Main() { Employee employee = new Employee (); // The data members are inaccessible (as they are declared private), // They can't be accessed like this: // string name = employee.name; // double salary = employee.salary ; // 'name' is indirectly accessed via method: string name = employee.GetName (); // 'salary' is indirectly accessed via property double salary = employee.Salary ; Console .WriteLine ( "Employee Name = {0}, Employee Salary = ${1}" , name, salary); Console .ReadLine (); //Output: Employee Name = Pinkah Poondh , Employee Salary = $54452.34 } } }
Access Modifiers - protected These types can be accessed within its class and by derived class instances namespace PROG8060Encapsulation { class Coordinates { protected int latitude; protected int longitude; } class DerivedCoordinates : Coordinates { static void Main() { DerivedCoordinates dcoord = new DerivedCoordinates (); // Direct access to protected members: dcoord.latitude = 85; dcoord.longitude = 43; Console .WriteLine ( "latitude = {0}, longitude = {1}" , dcoord.latitude , dcoord.longitude ); Console .ReadLine (); } } // Output: latitude = 85, longitude = 43 }
Access Modifiers - internal These types are commonly used when developing components of an overall solution. Having this modifier allows a group of components to work amongst themselves without being accessible to the remainder of the code. As a result, objects are only accessible in their own assemblies.
Access Modifiers – protected internal These types are accessible only from within the current assembly or from types that are derived from the containing class.
Access Modifiers – Summary Access Modifier Internal to Assembly External to Assembly With Inheritance With Type With Inheritance With Type Public Yes Yes Yes Yes Private No No No No Protected Yes No Yes No Internal Yes Yes No No Protected Internal Yes Yes Yes No
Agile
Agile Software Development Methodology From Wikipedia : Agile software development is an approach to software development under which requirements and solutions evolve through the collaborative effort of self-organizing and cross-functional teams and their customer(s) / end user(s) . [1] It advocates adaptive planning, evolutionary development, empirical knowledge , and continual improvement , and it encourages rapid and flexible response to change. [2] The term Agile was popularized, in this context, by the Manifesto for Agile Software Development . [4] The values and principles espoused in this manifesto were derived from and underpin a broad range of software development frameworks , including Scrum and Kanban . [5] [6]
Agile Software Development Methodology Focus is applied on: Individuals and Interactions over processes and tools Working Software over documentation Customer Collaboration over contract negotiation Responding to Change over following a plan
Agile Software Development Methodology Based on the following twelve principles for software development: Customer satisfaction by early and continuous delivery of valuable software. Welcome changing requirements, even in late development. Deliver working software frequently (weeks rather than months) Close, daily cooperation between business people and developers Projects are built around motivated individuals, who should be trusted Face-to-face conversation is the best form of communication (co-location)
Agile Software Development Methodology Continued… Working software is the primary measure of progress Sustainable development, able to maintain a constant pace Continuous attention to technical excellence and good design Simplicity—the art of maximizing the amount of work not done—is essential Best architectures, requirements, and designs emerge from self-organizing teams Regularly, the team reflects on how to become more effective, and adjusts accordingly
Agile Software Development Methodology https://www.flickr.com/photos/98353365@N02/9365724868/
How are we going to use Agile? Students will be developing the following for the Project: Project Proposal Requirements, Specifications Project Plan High Level Design, Architecture, Test Strategy Unit and Integration Tests System Tests Acceptance Tests Final Report and Presentation
How are we going to use Agile? Each week, during the lab time, we (your group and I) will be meeting in-person to discuss: What did each of you work on since our last meeting? What will each of you be working on until our next meeting? Are there any obstacles that you’re facing? Every other week (i.e. 2-week Sprints), we will be having a demonstration of what your group accomplished as well as a retrospective (what worked well, what didn’t, any obstacles)
Project Work
Project Overview Full Semester project to develop a quality application Three versions will be required… Versions 1 and 2 to contain a subset of the overall feature set Version 3 to contain the full feature set Measuring QUALITY at each version – final report and presentation at the conclusion Worth 40% of your overall mark
Project Overview Conducted using an Agile Development Methodology Weekly updates focusing on: What did you do since last meeting? What are you planning on doing until the next meeting? Any obstacles / roadblocks that are preventing you from progressing? Bi-Weekly Sprints with demos and retrospectives Attendance is MANDATORY ( -10% if you miss an update / sprint meeting or -5% if you come late to that class)
Task 1: Getting Your Groups Together… Groups to be setup by next class (i.e. Friday of this week) Update the “PROG8060 Group Names” spreadsheet by EOD Tomorrow No more than three students to a group First SCRUM meeting this Friday @ 11:00am – be prepared on what you’re going to be doing next week for your project You will be working with these individuals for the rest of the semester – so choose wisely All members must contribute equally to the overall project May move to individual grades if this is not being adhered to