Test-Driven Android: RecyclerViews

Welcome! You’ve landed on the second post in a series of posts designed to be companion reading for Android Programming: The Big Nerd Ranch Guide, 2nd ed.

Here is the first of those posts. 

RecyclerView

BNR goes step-by-step through how to make a RecyclerView and all of the component objects that come together to make it work. The RecyclerView differs from the ListView, which is the list creation method that I have used the most in Android, so I was excited to see the RecyclerView in action. That having been said, the explanation in the book spreads out over several pages; I wanted to find something more concise to help me achieve a high-level picture of how everything talks to each other and how I might implement a RecyclerView on my own rather than copying the code verbatim in the book. I found this blog post by Ashraff Hathibelagal, which helped me sketch out a responsibility diagram for RecyclerViews to contrast with a responsibility diagram of its predecessor, the ListView/GridView:

Continue reading “Test-Driven Android: RecyclerViews”

SpringOne: The Bootiful Microservice as a Microcosm for a Larger Discussion of Spring

This morning at SpringOne, Josh Long and Dave Syer provided an introduction to writing microservices with Spring Boot with a live coding session demonstrating the construction of a Spring microservice. The entire process took about 60 minutes (with frequent stops for explanation) and resulted in a service that returned reservation information. The code can be found here.

In the fast and inspiring demo, a few things happened that touched upon larger concepts that Spring developers encounter on a regular basis. A conference like Spring One provides us an unusual opportunity to discuss those concepts with other Spring developers. So this blog post provides an event-specific conversation starter for discussing those concepts.

Continue reading “SpringOne: The Bootiful Microservice as a Microcosm for a Larger Discussion of Spring”

SpringOne: Modern Java Component Design with Spring 4.2

Jurgen Holler and Stephane Nicoll’s SpringOne talk toured the annotations available to enhance the design of our classes in Spring.

Mr. Holler started off with an example service class. We walked through some of the Spring annotations used in it:

@Service — a version of the @Component annotation called a stereotype: it serves to inform developers that this is specifically a component of the service type.
@Autowired — When placed on top of a constructor, allows automatic dependency injection. (Sidenote: on top of the class itself, allows field injection).
@Transactional — A declarative annotation for tapping into a middleware service

Then, things got more advanced. We talked about some of the features of Spring annotations that give developers control over the structure and design of their applications.

Continue reading “SpringOne: Modern Java Component Design with Spring 4.2”

Test-Driven Android: Testing Layout Elements with Subclass and Override

There are a lot of reasons to write well-tested code: to drive software design decisions, to document the existing system, or to create a safety harness for confidently executing changes and refactors. But the Android framework (like most mobile and web frameworks) does not always lend itself to easy unit testing. Today we’ll talk about one particular case: the one in which you want to test that a method call on a view object that gets instantiated in the layout for an activity or a fragment.

Continue reading “Test-Driven Android: Testing Layout Elements with Subclass and Override”

Blog at WordPress.com.

Up ↑