Kent Beck: Best Practices for Software Design with Low Feature Latency and High Throughput

I was fortunate to attend Kent Beck's lecture summarizing his experiences and thoughts regarding efficient software design. Traditionally there have been two schools of thought about design: Predictive design, trying to design everything upfront (and making lot of wrong decisions) and reactive design, where any design is only done if it is absolutely necessary for implementing a feature (thus developing often on top of an insufficient design). Kent tried hard to discover such a design method that really delivers on the promises of both while avoiding their failures. This method is based on evolving design frequently in small, safe steps and focusing on learning while following some key best practices. It doesn't really matter what scope of design we are are speaking about, the method and principles are the same whether you're redesigning a class or a complex system.


Continue reading →

Link: Benchmark and Scaling of Amazon RDS (MySQL)

Performance and scaling of the Amazon-managed MySQL, Relational Data Store (RDS):

Continue reading →

Most interesting links of February '12

Recommended Readings


Continue reading →

Profiling Tomcat Webapp with VisualVM and NetBeans - Pitfalls

Profiling a webapp running on Tomcat with VisualVM or NetBeans wasn't as easy as expected, so this is a brief record of what to avoid to succeed.

Continue reading →

Cool Tools: Fault Injection into Unit Tests with JBoss Byteman - Easier Testing of Error Handling

How do you test error handling in your application? Do you? Is it at all possible to simulate SocketTimeoutException, SQLException? Normally the answer would be that it isn't possible or very difficult, requiring a complicated setup. Not anymore - with JBoss Byteman you can easily inject whatever code - e.g. throw new SocketTimeoutException() - in any place - e.g. Socket.connect. The code is injected before your test runs and unloaded when it finishes. Here is an example:


@RunWith(BMUnitRunner.class)
public class BytemanJUnitTests {
@Test(expected=MyServiceUnavailableException.class)
   @BMRule(name="throw timeout at 1st call",
   targetClass = "Socket",
   targetMethod = "connect",
   action = "throw new java.io.IOException()")
   public void testErrorInPipeline() throws Exception {
      // Invokes internally Socket.connect(..):
      new MyHttpClient("http://example.com/data").read();
   }
}



Continue reading →

Release 0.9.9 of Static JSF EL Expression Validator with Annotated Beans Autodetection

I've released version 0.9.9 of Static JSF EL Expression Validator (tool to check that EL expressions in JSF pages use only existing beans and properties), available for download from Maven Central. The main addition since the last version is the ability to detect managed beans based on annotations instead of reading them from faces-confix.xml or Spring config, thanks to the cool Reflections lib, and support for ui:repeat.


Continue reading →

Using Java Compiler Tree API to Extract Generics Types

I was looking for some way to extract information about types of elements in Java collections/maps using generics (List<String>, Map<String, MyBean>) so that the users of the Static JSF Expression Validator wouldn't need to declare the type of the elements manually. One possible way to get this information is to process the source codes with the Sun Compiler Tree API, available since JDK 6.

It might be best to go and check the resulting 263 lines of CollectionGenericsTypeExctractor.java now. The code is little ugly, largely due to the API being ugly.


Continue reading →

Separating Integration and Unit Tests with Maven, Sonar, Failsafe, and JaCoCo

Goal: Execute the slow integration tests separately from unit tests and show as much information about them as possible in Sonar.

The first part - executing IT and UT separately - is achieved by using the maven-failsafe-plugin and by naming the integration tests *IT (so that the unit test running surefire-maven-plugin will ignore them while failsafe will execute them in the integration-test phase and collect results in the verify phase).

The second part - showing information about integration tests in Sonar - is little more tricky. Metrics of integration tests will not be included in the Test coverage + Unit tests success widget. You can add Integration test coverage (IT coverage) widget if you enable JaCoCo but there is no alternative for the test success metrics. But don't despair, read on!

Important notice: The integration of Sonar, JaCoCo and Failsafe evolves quite quickly so this information may easily get outdated with the next releases of Sonar

Versions: Sonar 2.12, Maven 3.0.3


Continue reading →

Troubleshooting Jersey REST Server and Client

The logging in Jersey, the reference JAX-RS implementation, is little sub-optimal. For example if it cannot find a method producing the expected MIME type then it will return "Unsupported mime type" to the client but won't log anything (which mime type was requested, which mime types are actually available, ...).  Debugging it isn't exactly easy either, so what to do?

Well, I don't know the ultimate solution but want to share few tips.


Continue reading →

Most interesting links of January '12

Recommended Readings


Continue reading →

How to Create Maintainable Acceptance Tests

This post summarizes what I've learned from various sources about making acceptance or black-box tests maintainable. This topic is of great interest to me because I believe in the benefits that acceptance tests can bring (such as living documentation) but I'm also very much aware that it is all too easy to create an unmaintainable monster whose weight eventually crushes you. So the question is how to navigate the minefield to get to the golden apple?

The key elements that contribute to the maintainability of acceptance tests are:

  1. Aligned business, software, and test models => small change in business requires only a similarly small change in the software and a small change in tests (Gojko Adzic explains that very well in his JavaZone 2012 talk Long-term value of acceptance tests)
    • The key to gaining the alignment is to use business language in all the three models from the very start, building them around business concepts and relationships
  2. Testing under the surface level, if possible
    • Prefer to test your application via the service layer or at worst the servlet layer; only test on the UI level if you really have to and only as little as possible for UI is much more brittle (and also difficult to test)
    • The more you want to test the more you have to pay for it in the terms of maintenance effort. Usually you decide so that you cover the part(s) of the application where the most risk is - the best thing is to do cost-benefit evaluation.
  3. Isolating tests from implementation by layers of test abstraction
    • Top layer: Acceptance tests should only describe "what" is tested and never "how" to test it. You must avoid writing scripts instead of specifications.
    • Layer 2: Instrumentation - right below the acceptance test is an instrumentation layer, which extracts input/output data from the test and defines how to perform the test via a high-level API, provided by the next level (we could say a test DSL) such as "logInUser(X); openAccountPage();"
    • Layer 3: High-level test DSL: This layer contains all the implementation details and exposes to the higher layer high-level primitives that it can use to compose the tests without depending on implementation details (ex.: logInUser may use HtmlUnit to load a page, fill a form, post it). See the PageObject example below.


(And of course many, if not all, of the rules for creating maintainable unit tests apply as well.)


Continue reading →

Visualize Maven Project Dependencies with dependency:tree and Dot Diagram Output

The dependency:tree
Continue reading →

uCertify

Some guy from uCertify
Continue reading →

Key Lessons from the Specification by Example Course, Day 1

I'm taking part in a course of Specification by Example, lead by Gojko Adzic. Here I want to summarize the key things I've learned in the first day of this entertaining and fruitful course thanks to both Gojko and my co-participants.

If you haven't heard about Specification by Example (SbE) before (really?!), then you need know that its main concern is ensuring that you build the right thing (complimentary to building the thing right), which is achieved by specifying functionality collaboratively with business users, testers, and developers, clarifying and nailing them with key examples, and finally, where it is worth the effort, automating checks of those examples to get not only automated acceptance tests but, more importantly, a "living documentation" of what the system does that never gets out of date. Best to read the key ideas described by Gojko himself or the SbE Wikipedia page.
Continue reading →

Annual Blogging Report 2011

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Continue reading →

Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob