Archive for September, 2010

Mockups and Tools

2

IRC can be an excellent source of information, especially on the right networks, but every once in a while you have a conversation that is so disappointing you have to share it.



22:15 < morgajel> I'm using mockito to mock up a Dao, but I've run into an issue: What is the proper way to mock up chained getters, i.e. sessionFactory.getCurrentSession().createCriteria(Account.class).list()? a mock with a mock with a mock is considered bad form, so I'm not really sure how I *should* handle this.
22:15 <@toolA> Stop using mocks?
22:15 <@toolA> They are damned pointless anyways
22:16 <@toolA> Use somthing like Junit or spring-db tests, setup a whole cycle with a in memory db, then run that against your queries.
22:16 <@toolB> ~mock toolA
22:16 * javabot points at toolA and laughs
22:17 < morgajel> toolA... really? that's the advice you're gonna give me? "Don't use mocks when unit testing?"
22:17 <@toolB> yeah. i prefer that route over mocks, personally, even though it means testing takes slightly longer.

He continued to rant against mocks and declare them useless. A couple of things disappointed me about this:

  1. I asked a well formed, non-inflammatory question, and the response was to completely ignore the question and say what I was doing was worthless, despite being a well accepted development practice.
  2. Not only did one oper state that mocks were useless, but another one didn’t disagree with his blanket statement. While they *may* have a point that mock objects do not cover everything, to call them useless is unreal, especially in a programming channel.
  3. Rather than say “I don’t use mocks” and let someone who could answer my question respond, the conversation was then dominated by a diatribe about all of the faults with mocks.
  4. The thing I took away from this was “don’t bother asking questions in this channel because people who don’t use the tech you’re asking about will pipe up and shoot you down regardless of how nicely you ask.”

It’d be one thing if I were off topic, or it was not a programming channel, but damnit I expected better. So I don’t think I’ll be going back there anymore.

(And no, the irony isn’t lost on me.)

SPoE: Dud fuses, mvc fun and Mockups

1

So SpringFuse was a dud. In the end it was just wasn’t a good fit for me. I’m trying to learn java and spring along the way and the library conflicts were getting out of hand. I dumped it and more or less zeroed out my checkout.

On the bright side, trying to debug springfuse taught me quite a bit about maven, java dependencies,  using eclipse for debugging, and spring classes. By the time I grabbed mvc-basic from springsource samples and started looking at how it handled accounts, I had a fairly good grasp of how to not only understand spring, but debug common issues. All that said, I still know relatively nothing compared to some of the devs I know.

Finally, I found some great tools for wireframing. So far I’ve only played with Cacoo, but there are a few others I want to try. I need to start mocking up what I really want from this site.

SPoE Update: findbugs, emma and springfuse

0

So far,  getting infrastructure in place has been much easier than actually doing any coding. As it stands now, I have added the following helpers:

  • Cobertura and Emma: Code coverage.
  • Findbugs: finding obvious bugs in my code
  • PMD: Find other problems in the code.

So far that’s all I have- bells and whistles to distract me from doing actual work. Ideally they’ll help keep me honest about code quality, but this early in the game they don’t offer much value.

As far as development goes, I found a neat little site called springfuse which, when given a database schema, reverse engineers an entire site for you. It seemed pretty impressive, and I began using that as a baseline for development… the only problem with springfuse was that it used antiquated packages. Short off falling back to Spring 2.5, and an older version of hibernate, it would be a royal pain in the ass to get it all functional.

I’ve stripped out most of the springfuse code at this point, only keeping the base Account class and surrounding classes. If it is salvageable, I may also try and save Role and AccountRole. I’m not saying there’s anything wrong with using springfuse- it seems like a great time saver for someone familiar with spring, but I think it would cause me me grief than effort it would save.

In the mean time I’ll be reading up on spring security 3.0.x, and hope to get a simple account model in place well enough to create accounts and log in. With any luck this long weekend will help.

Go to Top