Lecture #12 Software Engineering PDF
Document Details
Uploaded by ObtainableAntigorite4459
Tags
Summary
This document is a lecture on software engineering, outlining the key phases of software development. It covers topics such as requirements, design, coding, testing, version control, and even introduces concepts like Test-Driven Development (TDD) and tools like Selenium.
Full Transcript
Lecture #12 Software engineering Phases of software development Software engineering can broadly be split into the following steps: Requirements say what the software should do. Software design is usually done on paper. It says what the different parts of the software are, and how they ta...
Lecture #12 Software engineering Phases of software development Software engineering can broadly be split into the following steps: Requirements say what the software should do. Software design is usually done on paper. It says what the different parts of the software are, and how they talk to each other. Coding (Implementation) After the design phase is done, each component (part) of the software is coded. Code is what tells the computer exactly what to do at each step. Testing is done to see if the components meet the requirements and that the system as a whole meet the requirements. Part or all of this process can repeat if bugs are found or new requirements are needed. Requirements Speak with client, understand what he needs. Understand which hardware is needed, which software, libraries are needed. Problems: Mostly client doesn't clearly understand what he needs. Mostly client and developer uses different terms for same words, or uses same terms for different things Solutions: Document everything, create prototypes Functional and nonfunctional requirements A functional requirement describes what a software system should do, while non-functional requirements place constraints on how the system will do so. An example of a functional requirement would be: A system must send an email whenever a certain condition is met (e.g. an order is placed, a customer signs up, etc). A related non-functional requirement for the system may be: Emails should be sent with a latency of no greater than 12 hours from such an activity. The functional requirement is describing the behavior of the system as it relates to the system's functionality. The non-functional requirement elaborates a performance characteristic of the system. Prototype Before developing application, developers should create prototypes. Creating prototype gives understanding what should be done, and how it will work Software design Software design: it is not about buttons or which font to use Software design: it is about which classes will be created, how they interconnect, how server and client works with each other and etc Following questions should be answered on this stage: Which OS will be used? Which libraries or frameworks are needed? What classes will be created? Coding The longest part of software development Few points which we need to take care in this phase. Version control application required in this phase. Before begin the actual coding, you should spend some time on selecting development tool, which will be suitable for your debugging, coding, modification and designing needs. Before actual writing code, some standard should be defined, as multiple developers going to use the same file for coding. During development developer should write appropriate comments so that other developers will come to know the logic behind the code. Last but most important point. There should be a regular review meeting need to conduct in this stage. It helps to identify the prospective defects in an early stage. Helps to improve product and coding quality. Version control systems Version control (source control or revision control): A version control system remembers the history of your files. If you stuff something up, you can get an earlier version back again. A version control system helps to share changes. It makes things easier to manage if several of you are working together, or if you are working in more than one location. Examples of Versioning systems are: GIT SVN Mercury Git Git is a version control system that takes snapshots (versions of file) in local system. After that this version can be uploaded to repository (you can save it freely on Github.com) Git Tutorial git clone git@github.com:ardakshalkar/gittest.git (Path from GitHub site) Create file: filename.txt git add filename.txt - files are added to current version git add. - add all files to stage git add *.txt - add all txt files git rm filename.txt - remove file Git commit "git commit" saves current files to current versions Following command creates version with message "My first version" git commit -m "My first version" Git push and git pull Command "git push" sends data to "master" repository Command "git pull" requests files from "master" repository Git examples 1. git config –global user.email “[email address]” 2. git init [repository name] 3. git add file 4. git commit -m “Some text” or git commit -a 5. git remote add origin https://github.com/Abdinurova/origin.git 6. git push -u origin master Git diff and git history git diff - difference between current files and last commit git diff "@{yesterday}" - what have changed from yesterday git log --oneline - outputs lines of previous commits git checkout fc53bcd - This makes your working directory match the exact state of the fc53bcd commit. You can even edit files without worrying about losing the current state of the project. Nothing you do in here will be saved in your repository. git checkout master - return to current version git reset --hard 79f0fa3 - go back to 79f0fa3 commit Testing Testing is a process of checking our program to errors. Nowadays testing phase is made automatically. Testers are people who write tests. Some explanation: When program is very simple (like in 1960s-1980s) you do not need to test it. Because you can check all variants by yourself in 5 minutes. History of Software testing But when it got more and more complex, you have to create system that will check for errors automatically Unit testing vs Integration testing Unit testing is a type of testing to check if the small piece of code is doing what it is supposed to do.Integration testing is a type of testing to check if different pieces of the modules are working together. Unit testing checks a single component of an application.The behavior of integration modules is considered in the Integration testing. The scope of Unit testing is narrow, it covers the Unit or small piece of code under test. Therefore while writing a unit test shorter codes are used that target just a single class. The scope of Integration testing is wide, it covers the whole application under test and it requires much more effort to put together. TDD (Test Driven Development) Test Driven Development is a process of software development. Steps in TDD: 1. Write test (there is no code yet), so your test is failed 2. Write some code, it may not be the best solution, but it pass tests 3. Run tests, to check if new test doesn't break any previous tests 4. Refactor code, update code added in step #2, make it solve the problem correctly Selenium Selenium is a software for testing user-interfaces. You can write code that automatically will do some manipulations with browser elements, like enter login and password, then click some button and see specific result Unit tests Java public class Arithmetic{ public int add(int x,int y){ return x+y; } @Test public void testAdd(){ assertEquals(4,add(3,1)); } } Maintenance After company created product (software application, web-site) it should be maintained Maintenance is: adding new features fixing bugs Waterfall model Agile