Turnleaf Design Ramblings of a junior developer

4Nov/092

Ramblings: Should unit tests talk to a data source?

Last week I published an article on test driven development. One person who read my article (briefly) suggested I did not know that unit tests shouldn't talk to their data source. I plan on covering how to mock JDBC connections later this week, however I wanted to do some research to see if what my critic says is an industry standard or a philosophical choice.

Surprisingly there seems to be relatively little information on this subject, or I have been incapable of finding information. From what I have gathered though, the theory that data sources should be mocked is sound, but its may not always be practical to implement it. Below is two reasons why data source connections should be mocked and three reasons why they should not.

Technorati Tags: , , , ,

23Oct/097

Comments are a sign of bad code and I am not sorry for saying it

In my recent article, 8 signs your code sucks, one of my signs of bad code is: “You need to use comments to explain the code.” I have since taken a lot of flak for suggesting this and I want to clarify my point and why I am not backing down.

Not javadoc - I am NOT referring to Javadoc or its equivalents in other languages. I absolutely do agree that a method or class should have accompanying documentation at its declaration stating its purpose and its inputs and/or outputs.

Technorati Tags: ,

21Oct/0926

8 Signs your code sucks

As a wide eyed junior developer when I first began working on large projects I simply accepted that it is difficult to fix bugs or find where an action is being executed. If only I knew then what I know now, I would had saved myself hours of frustration. The first step to writing good code is accepting the code you write (or work on) is crap, but sometimes you need to know what to look for. Here are some signs that your code sucks.

A method is larger than the screen – A method should only perform one specific task. A method should not contain the logic code to determine if the username field contains data, is valid, and that user exists. If a method is too large to fit within a single screen, that is a (very) good sign it is doing too much.

Technorati Tags: ,

19Oct/0914

12 Tips to make you more productive using Eclipse

Integrated development environments make developing application fair easier. They highlight syntax, let you know if you have a compilation error, and allow you to step through your code among so many other things. Like all IDEs Eclipse has a bunch of little shortcuts and tools that can make your life a lot easier, I've compiled a list of several that I use on a daily basis:

1. Auto-complete – Eclipse has an auto-complete feature that can be accessed with ctrl + space. When clicked a small pop-up box is displayed with a list of context sensitive suggestions. If there is only one possibility then Eclipse completes it for you.

Technorati Tags:

12Oct/090

Help support Turnleaf Design

If you like what I have to say, share it with others by using the "Share" button at the bottom of every post. This button includes links to all the popular social sites. Help get Turnleaf Design out the masses by submitting an article or up voting already submitted articles. Your help is much appreciated, thanks!

Filed under: Ramblings No Comments
12Oct/090

Hello from the future

With the publication of the first part of my SVN primer I will begin two major series on my site that will occasionally intermingled. My first series is what I like to refer as “The Promised Land.” This project will cover how to setup up an ideal development environment. Subjects will include version control, Ant (build scripts), Ivy (dependency manager), software configuration management (SCM), automated unit testing, and bug tracking. I may add a few subjects as requested or if I find anything else I think might be relevant and interesting. The series is name “The Promised Land” because hopefully by following the advice in the articles a development team can focus only on developing and maintain its applications and not have to worry about any other hassles. I will put all the "Promised Land" articles under the "Promised Land" category.

16Sep/090

What are Java beans?!

Sometimes developers use programming jargon that new developers have a hard time comprehending. One term I frequently hear is “bean.” All a JavaBean is, is a class used to define the attributes of a entity; examples of commonly used beans would be person, customer, and employee. A JavaBean typically only contain private attributes and the getter and setter methods to access and set those attributes respectively.