[mas 500] software development strategies

27
MAS.500 - Software Module - Rahul Bhargava Software Dev Strategies 2014.11.12

Upload: rahulbot

Post on 07-May-2015

627 views

Category:

Education


0 download

TRANSCRIPT

Page 1: [Mas 500] Software Development Strategies

MAS.500 - Software Module - Rahul Bhargava

Software Dev Strategies

2014.11.12

Page 2: [Mas 500] Software Development Strategies

Data StructuresTesting

Managing ComplexitySource Code Management

LicencesAlgorithms

Page 3: [Mas 500] Software Development Strategies

Data Structures

Page 4: [Mas 500] Software Development Strategies

❖ Array

❖ HashMap/Dictionary/AssociativeArray

❖ List

❖ Queue (FIFO)

❖ Stack (LIFO)

❖ Tree (parent/children)

❖ Graph (node/vertex)

Page 5: [Mas 500] Software Development Strategies

Testing

Page 6: [Mas 500] Software Development Strategies

Approaches

❖ Motivations

❖ Make sure individual pieces of your project work, before sticking them together

❖ Ensure changes in one part of system haven’t broken another part by mistake

❖ Strategies

❖ Unit Testing, Functional Testing, Integration Testing

❖ Technologies

❖ xUnit (ie. jUnit for Java, pyUnit for Python, Test::Unit for Ruby, etc)

Page 7: [Mas 500] Software Development Strategies

Unit Test Anatomy

❖ Load up some test data

❖ Run some piece of your code on your test data

❖ Verify the result is correct

❖ Remember to test the multiple valid paths through your piece of code, not just the most likely one (ie. test edge cases too)

❖ demo

Page 8: [Mas 500] Software Development Strategies

Strategies

❖ Test Driven Development

❖ Write your tests before your code?

❖ Continuous Integration

❖ Automated build/test cycle, all day long

❖ Pair Programming

❖ Two heads are smarter than one?

❖ 80/20

❖ Write tests for the most critical low-level parts of your system

Page 9: [Mas 500] Software Development Strategies

Managing Complexity

Page 10: [Mas 500] Software Development Strategies

It’s Easy to Remember Less

❖ Abstraction

❖ Higher level commands are easier to use

❖ Simplifying assumptions

❖ Convention makes things easier to guess

❖ Readability

❖ Remember WTF something does 6 months later

❖ Commenting

❖ Focus on the why, not the what

Page 11: [Mas 500] Software Development Strategies

Reminders

❖ “Refactor” Constantly

❖ Change how your code does what it does to reflect things you learn

❖ Keep the “Technical Debt” (video) approach in mind

❖ Text Editors, Integrated Development Environments (IDEs)

❖ Can help, or hurt, your code process

❖ Some Examples: PyDev, Eclipse, Xcode, Visual Studio, Mono Develop, Aptana Studio

❖ IDE demos

Page 12: [Mas 500] Software Development Strategies

Source Code Management

Page 13: [Mas 500] Software Development Strategies

SCM

❖ Motivations: cover-your-rear, collaborate on code, control deployment

❖ Technologies: CVS (old school), SVN (centralized), git (distributed)

Server

Sally Bob

code changes code changes

Page 14: [Mas 500] Software Development Strategies

SCM: Processgit (with a server)

• Clone repository to your computer (only once)

• Change code• Commit changes locally• Pull changes from server• Merge any conflicts• Commit fixes locally• Push all commits back to server

Learn More:

git-scm.com/book/en/Getting-Started-Git-Basics

SVN• Checkout code to your computer (only once) • Change code• Update code to get any changes from the

server• Merge conflicts• Commit changes back to server

Learn More:http://svnbook.red-bean.com/en/1.6/svn.basic.in-action.html

…lets not relive the dark days of CVS…

Page 15: [Mas 500] Software Development Strategies

SCM: Example

❖ Setup

❖ With git you usually have to set up SSH keys first for authentication

❖ Clone the project to get the repository from the server to your computer

❖ git clone [email protected]:username/project.git

❖ Process

❖ Make your changes (for example, edit README.txt)

❖ Stage the changes that you want to commit

❖ git add README.txt

❖ Commit the changes

❖ git commit –m “Better instructions”

❖ Push the changes to the main branch (master) on the server (origin)

❖ git push origin master

Page 16: [Mas 500] Software Development Strategies

DEMO

Page 17: [Mas 500] Software Development Strategies

Handling Conflicts

❖ Structuring your source files well helps avoid conflicts

❖ Using MVC can help (see later slides)

❖ Uh oh, we both changed same part of the README.txt!

❖ When if happens, open the file and find the conflict:

❖ <<<<<<<< HEAD:README.txt

❖ My code here

❖ =================

❖ Other person’s new code here

❖ >>>>>>>>>>> [their_version]:README.txt

❖ Pick which version to keep and delete the other stuff

❖ Read more in the gitbook

❖ git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts

Page 18: [Mas 500] Software Development Strategies

SCM: Tags and Branches

❖ Tags - take a snapshot of your repository at a certain point in time

❖ Useful for deploying specific snapshots of code that you know work to a server/demo-box

❖ Branches – work on side projects without affecting your main development

❖ git makes merging branches easier, but should still be done carefully

Page 19: [Mas 500] Software Development Strategies

SCM: Repo Hosting❖ Necsys can host repositories

❖ http://wiki.media.mit.edu/view/Necsys/MediaLabGITServer

❖ http://www.github.com

❖ public, social, issue tracking, project maps 1-to-1 onto repository

❖ mit has an enterprise site license (http://github.mit.edu/)

❖ http://gitorious.com

❖ Open source, organized by projects with multiple repositories

❖ http://code.google.com

❖ http://sourceforge.net

Page 20: [Mas 500] Software Development Strategies

SCM: Desktop Tools

❖ command line

❖ Tortoise for Windows:

❖ http://tortoisesvn.net

❖ http://code.google.com/p/tortoisegit/

❖ GitHub for Mac

❖ http://mac.github.com

❖ GitBox for Mac

❖ http://www.gitboxapp.comh

❖ Eclipse

Page 21: [Mas 500] Software Development Strategies

SCM: GitHub

❖ online hosting

❖ ssh keys

Page 22: [Mas 500] Software Development Strategies

Licences

Page 23: [Mas 500] Software Development Strategies

http://marakana.com/s/post/1030/understanding_open_source_licenses

Page 24: [Mas 500] Software Development Strategies

http://www.shafqatahmed.com/2008/10/comparison-of-d.html

Page 25: [Mas 500] Software Development Strategies

Algorithms

Page 26: [Mas 500] Software Development Strategies

❖ Measured based on efficiency (good examples)

❖ Fixed time: O(1) - Fast!

❖ Pull the 10th value out of an array

❖ Log time - O(log n) - Scales well!

❖ Find a number in a sorted array via binary search

❖ Linear time: O(n) - Does ok!

❖ Sum an array of numbers

❖ Exponential time: O(2n) - Scales poorly!

❖ Graph traversal stuff

Page 27: [Mas 500] Software Development Strategies

Homework

❖ see course outline: bit.ly/mas500f14