Turnleaf Design Ramblings of a junior developer

6Oct/106

Log4j 4 Enterprise

Logging is an important part of any application. Logging provides debugging information, the state of the application, and a record of what happened when the application failed. As applications increase in size so does the demands and complexity of logging. Without a proper logging system it can become difficult to determine from where in an application a log statement is being executed and without an easy way of changing logging behavior it can have a negative effect on an application's performance.

The Apache Foundation maintains the log4j project which is an easy to use system that provides a large array of really cool features for logging. This tutorial, part of my dev environment series, is an introduction into using log4j in an enterprise setting. Topics that I will cover include; implementing log4j in a project, customizing the log statement, usage of appenders, creating loggers and logger inheritence,  and setting up log4j to work on an application server. This will cover many of the basic needs of enterprise logging.

A few simple steps before we begin...

As with all my tutorials that involve coding you can download the source code here. In this example I will be using the project HttpExample, starting on revision 24. If you want to work on this code locally you will also need the log4j library which can be found here, and then add it to your project's classpath by right clicking on your project > build path > add external libraries and then navigate to the library's location (if you are using eclipse).

Bookmark and Share
15Sep/1013

6 traits of successful developers

While perhaps easier to get into than it should be, software development is a difficult and demanding field to be successful in over a long period of time. A lot is asked of developers as we are often given nebulous business requirements and asked to make a functioning system. In my experience here are six traits all successful developers seem to poses.

1.Pupil

For a developer to be successful over any period of time a continued commitment to learning is absolutely vital. The field is too large, too quickly changing, and too in depth for any developer to ever "know it all." Luckily there are a lot of resources a developer can use to learn; books, co-workers, classes, blogs, among many others.

In my personal experience I have found one of the best resources for learning have been my co-workers. Books, classes, and most online resources are largely impersonal and geared toward large audiences, they simply cannot provide the help that a co-worker familiar with your issue or habits can provide. Which leads me to my next important trait...

Bookmark and Share
23Aug/100

Web developers should hate http

I don't mean that literally, what I do mean is a web developer should hate when Java's http specification is directly accessed in the code. This is a topic I briefly touched on in my 8 signs your code sucks post awhile back. I decided to return to this topic because it touches on a very important and fundamental programming practice which is limiting dependencies in code. This article represents the initial entry into a new series I plan on covering called "Java don't care." As aforementioned this series will focus on reducing dependencies in code, as well as making your code less aware of the environment it is in, and how following these practices will help you as a developer. But back to the task at hand; why referencing Java's http specification is bad.

Bookmark and Share
14Aug/100

An intro to writing ANT Scripts

What is Ant?

A(nother) N(eat) T(ool) is a tool developed by the Apache Foundation for automating tasks in a project. It is primarily, though not exclusively used for Java projects. Most developers interaction with ant is through the xml specification, which is used to define specific operations.

The objective of this tutorial

Ant was designed with adaptability and expandability in mind, as a consequence it is used for many tasks and in many systems. As we get deeper in the dev environment series we will rely heavily on ant to make our lives easier and to carry out many important functions. For this tutorial however I will go cover what ant is primarily used for, building a project and creating a deliverable, in this case a jar file. This will provide a good intro into the usage of ant and how it works.

Bookmark and Share
4Aug/100

Setting up SVN over http on Linux

One project I was planning on starting before I went on my extended hiatus was setting up a development environment, so it only seems natural that I start there again. I already went over how to setup a SVN repository, however in that example I used VisualSVN which require elements of Visual Studio and since I primarily focus on Java development, VisualSVN isn't a particularly good choice. So today I will go over how to setup a svn server in Linux (Ubuntu 10.04 to be exact).

Bookmark and Share
10Nov/090

Mocking JDBC Connections with MockRunner

Last week I published an article, An Intro into Test Driven Development with Junit4, which got somewhat mixed reviews. One particular commenter on reddit suggested I didn't understand that unit tests shouldn't talk to its data source. I decided to do some investigating into his claims, you can check out my findings here. I was however intrigued none the less and started looking for a tool that would allow me to easily mock a JDBC connection. I found Mockrunner to be the easiest to use of the ones I have found. Below is a brief tutorial on how to use Mockrunner. (Keep in mind that I am still fairly new to using Mockrunner)

Bookmark and Share
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.

Bookmark and Share
3Nov/090

Link dump 11/3

http://www.developerart.com – A new blog like my own. While not a whole lot yet, the content that is on his site is of high quality.

Kind of a smallish link dump I know. I plan on getting some new articles posted this week, namely an update to my TDD article I posted last Monday. So check back soon.

Bookmark and Share
26Oct/093

An Intro into Test Driven Development with JUnit4

Please read the technical guide before starting this tutorial.

This article will mark the first of a long-term series covering professional software development. For the lowdown on this project check out this article. Be sure to give me your feedback as it will be vital in helping me develop better tutorials in the future.

Test driven development seemed like a natural choice as a lead off to my series of tutorials as I had to explain why I am writing all these tests. It is also a very good development methodology that will actually save a lot of time by reducing the amount of time spent debugging. For this tutorial and the entire project, I will be using Junit4. For a synopsis on test driven development you can check out the wikipedia article here. If you need a brief refresher on JUnit you can read my tutorial here (written in Junit3).

Bookmark and Share
26Oct/090

The start of a long journey

A couple of weeks ago I posted about my ideas for the future of this site. Well today I start making good on those lofty promises. I will be posting my first tutorial, which will cover test driven development, shortly. Before I do that I want to give a bit of an explanation of this project, why I am doing it, what I hope to accomplish, a few other thoughts, and finally some technical notes.

Bookmark and Share