Download presentation
Presentation is loading. Please wait.
Published byRalph Austin Modified over 9 years ago
1
Presented by: Ben Palermo Nathan O’Grady
2
How to Program by Coincidence Accidents of Implementation ◦ It may just look like its working ◦ The boundary conditions may be an accident ◦ Behavior may change with the next library release ◦ Superfluous code makes execution time longer ◦ Extra calls increases the chances of new bugs Accidents of Context Implicit Assumptions
3
Be aware of what you are doing Understand the project and the language Use a plan Only rely on what you know for sure If you must assume, document it Test your assumptions, as well as your code Spend time on the important things Do not be afraid to rewrite existing code
4
O() notation Estimation ◦ Simple Loops ◦ Nested Loops ◦ Binary Chop ◦ Divide and Conquer ◦ Combinatoric Algorithm speed in practice
5
What is refactoring? When to refactor ◦ When two units perform the same action ◦ Non-orthogonal design ◦ New requirements or a better understanding of the problem ◦ Improving performance
6
Complications ◦ Pressure to release a product ◦ Refactor early, refactor often
7
How to refactor ◦ Refactoring is redesign ◦ Don’t refactor and add functionality ◦ Establish good tests before refactoring ◦ Make small, deliberate changes Test after each change ◦ Let refactoring changes break old builds
8
Unit Testing ◦ Testing done on individual modules in isolation to each other ◦ Creates artificial environment, then tests output based on known values
9
Using contracts ◦ Design unit tests to check that a contract is fulfilled ◦ Test modules in a bottom-up approach ◦ Design code to be tested (i.e. design with contracts in mind)
10
Writing Unit Tests ◦ Include in main source code As a separate, normally unused function ◦ Use test harnesses JUnit test cases Composable tests Include a debugging window in final build Culture of Testing
11
Don’t use wizard code you don’t understand. Be able to write wizard code without the wizard.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.