I attended a No Fluff Just Stuff Symposium a few weeks ago. One of the main emphasis during the weekend was learning new languages that are available on the JVM. While there are a variety of reasons that we need to take time to learn new programming languages, one of the most profound is learning to think about problems differently.
When I entered the development scene I was immersed in Object Oriented programming. As a result, I tend to think of good design in objects. A few years ago I began to learn and apply Groovy. With closures I was able to bleed into the realm of Functional programming. This gave me a small taste of a new paradigm. I thought of new ways to solve problems that I couldn’t see with Java. I can only imagine how much more I could learn if I developed exclusively in a Functional language for several months.
I’ve been asked several times to explain the difference between injecting Spring beans with ‘@Resource’, ‘@Autowired’, and ‘@Inject’. While I received a few opinions from colleagues and read a couple of posts on this topic I didn’t feel like I had a complete picture.
In order to explore the behavior of each annotation I fired up Spring Tool Suite and started debugging the code. I used Spring 3.0.5.RELEASE in my research. The following is a summary of my findings.
Open Sourcing Software
I’ve been using open source software for many years, but I’ve never open sourced my own project. This blog is a record of my experience as I start this journey. The resulting project can be found at http://beanoh.org.
First I had to decide where to store the code. There are several popular (Comparison of open source software hosting) open source hosting options. I chose GitHub (github.com) because I already had an account and I’m comfortable using Git. Furthermore, GitHub provides intuitive tools that make it easy to manage a project. I can setup an organization so multiple Source Allies employees can have commit rights on this project. GitHub also has an integrated issue and feature tracking system that connects commits with tickets. Overall I am very impressed with GitHub.
- What is Maven?
- Why not Ant and Ivy?
- But It Downloads the Internet
- Getting Started
- What is a POM?
- Convention over Configuration
- New Project
- Project Management
- Parent POM
- Local Maven Repository
- Multiple Artifacts from a Single Source
- Release Plugin
- Aggregate POM
- Dependency Management
- Distribution Zip
What is Maven?
Maven is a software project management and comprehension tool that includes: build tools, dependency management, project reporting and much more. I say “much more” because at the core Maven is a plugin execution framework. There are plugins supported by the Maven project (http://maven.apache.org/plugins/index.html), plugins supported by Mojo Project (http://mojo.codehaus.org/plugins.html), and third party plugins. If you can find or write a plugin, Maven can run it.
Spring is an essential part of my technology stack. I cann’t image providing quality software that doesn’t leverage an IoC container. However, decoupling components requires some amount of configuration. Whether this is accomplished through annotations or XML, it’s fairly easy to mess up. Fixing these missing or incorrect configurations doesn’t take very long. The real question is how quickly can you identify these errors?
This question of how long, is a feedback loop question. Unfortunately many teams wait until they fire up the application server to see if their Spring context is wired correctly. This is too late.
One of our clients suffered from this very issue. Due to environmental constraints they could not run automated, in-container tests that would have identified misconfigured beans. After repeatedly committing stupid configuration mistakes, I decided that I would write a Spring wiring test. As I began to write this I encountered five problems.
With Mockito 1.8.3 or higher you can significantly reduce your test code setup.
In Part I we covered
- Setting Up
- Recording Tests
- Playing Back Tests
- Saving Test Cases
- Resuming Recording
- Saving Test Suites
All examples will use the sample site https://sites.google.com/site/example4selenium/.
- There are two ways to store values.
- First, you can define custom variables
- Second you can use the drop-down ‘storeText’ option.
Pair programming is a technique where two programmers work at a single work station. One person “drives” or has control of the mouse and keyboard. The other person “navigates” or keeps track of where they are and where they are headed. This is a perfect environment for teaching and learning to occur.
I primarily use Selenium IDE in three areas:
- Defect – I ask testers to record their steps and attach the script to their defects. This is a simple way to communicate exactly how they found an issue. This technique significantly cuts down on communication overhead.
- Acceptance Testing – While I prefer writing tests before I write the code, this is a simple way to record tests on existing web applications. In part II I will show you how to export these recordings into Java. By exporting these scripts you can easily add them to your existing automated test suite.
- Demo Setup – I’ve found it handy to run small Selenium test cases to setup a demo. For example you may want to demonstrate the functionality on the tenth page that requires a log-in and multiple data entry steps. This approach can reduce demo setup time and enable you to focus on demonstrating new functionality.
Our client was tracking their daily status on a whiteboard in a conference room. A corporate memo was sent out banning the exclusive use of whiteboards for teams. As a result we turned to our web-based tracking tool. Unfortunately their whiteboard equivalent was clunky and inadequate. I spent a few hours putting together a Greasemonkey script that altered the look of this page to mimic our old whiteboard. These changes helped ease this transition.