Skip to main content

Posts

Showing posts from April, 2014

Dont Tie Yourself to a Framework

Programming is greatSoftware development is the crap bit. You'll spend more time configuring, integrating and faffing rather than writing logic most of the time.Test Driven Development makes development easier as it forces you to decouple your code. Your core logic should be pure, dependency free C#, Java, Python etc.Your frameworks and libraries should be on the edge of the system.Most people do this for some of their code, e.g. your data access.What about the other parts of a system?Web frontendREST api'sConsole applicationsDesktop clientsWhy should we couple our applications with these layers?Hexagonal ArchitectureHexagonal Architecture is a solution to limit couplingEasily switch out your delivery mechanism, e.g. test runner adapter for testing, HTML adapter for production.Great example from Kevin Rutherford.Excellent video by Uncle Bob though terminology differs.Implementation details should be hidden behind adapters.Tested manually in the majority of casesFew integrati…

Flexible Selenium Tests via Page Objects

A fast, automated suite of unit and integration tests are not enough. At some point you'll need to test your presentation logic. Ideally your domain/business/game logic is stubbed so all you'll need to do at this point is check that the presentation is complete. For example, does view X load view Y? Does an error message appear when an error is raised?With web sites and web applications the standard tool to use is the excellent Selenium. The problem with UI tests in Selenium is they are often slower to write. Not only this the maintenance cost of such tests can often be much more expensive that other styles of tests. If the cost of such tests is high, the likely hood of developers writing UI tests is low. In my experience there are three types of UI tests in use.Low LevelHere UI tests are wrote directly against Selenium. This low level approach means tests are scattered with assertions and UI details. For example element locators such as divs and ids will be used with methods …

Design is Important

When I was a student I used to cheat. Not in exams or practical assignments, but I used to cheat when it came to my process to develop code. Early on I noticed a common pattern. After receiving an assignment I would perform some analysis, figure out a basic design and document my steps. The problem came when to code up the solution. I may have overlooked something, or made a mistake. Sometimes I would just come up with a better solution. This meant any time I spent documenting was lost. It turns out this wasn't cheating, after all there was nothing within the assignments enforcing a waterfall approach.I wasn't alone with this experience. Most of my peers had the same issue, and the report aspects of an assignment were often disliked for this very reason. My solution was simple. Code up something, get it working then document the design aspect. Rinse and repeat. Back in the early 2004 I wasn't aware of agile methodologies, but this solution worked a treat. In turn my classm…