File.open("testfile", "r") do |file|
# ... process the file
end
Saturday, May 30, 2009
Open a file and it closes automatically
Friday, May 29, 2009
RSpec book
Test Behaviour Not Internal Structure
Unit Tests can be brittle in that they use internals of an object (eg. check register() method works by checking something was added to an internal array). If we change internals, test will fail even though behaviour hasn't changed. How can we avoid tying our unit tests to internals?
Design the API by using it
When writing code, call methods you wish you had - then you can implement them. Better than designing the API on its own.
Unit Tests can be brittle in that they use internals of an object (eg. check register() method works by checking something was added to an internal array). If we change internals, test will fail even though behaviour hasn't changed. How can we avoid tying our unit tests to internals?
Design the API by using it
When writing code, call methods you wish you had - then you can implement them. Better than designing the API on its own.
Wednesday, May 13, 2009
Supervising Controller
http://www.martinfowler.com/eaaDev/SupervisingPresenter.html
Pull complex view logic out into the controller to make it testable. In the examples, the controller listens to widget events, and does stuff with the input. Controller will update model, however can leave it up to the view to update model for basic stuff (which it might do using data binding).
Pull complex view logic out into the controller to make it testable. In the examples, the controller listens to widget events, and does stuff with the input. Controller will update model, however can leave it up to the view to update model for basic stuff (which it might do using data binding).
Sunday, May 3, 2009
TCP Tunnel Gui
http://jcbserver.uwaterloo.ca/cs436/software/tgui/tcpTunnelGUI.shtml
java -jar tunnel.jar 9999 jcbServer.uwaterloo.ca 80
java -jar tunnel.jar 9999 jcbServer.uwaterloo.ca 80
Subscribe to:
Posts (Atom)