Showing posts with label Software Development. Show all posts
Showing posts with label Software Development. Show all posts

Tuesday, September 20, 2011

Recipe#6: Configure Maven2

When I started programming 8 years ago, ANT was the build tool of choice for Java programs. These days, you are better off using Apache Maven, which adds dependency management, build profiles, and automation for common tasks (like documentation and site generation, distribution, and test).

To install Maven:
  1. Download the package from http://maven.apache.org/download.html.
  2. Unzip the contents to a location that will be Maven's home directory.
  3. Set the "M2_HOME" environment variable to point to the home directory. Some plugins still require it, although it is no longer necessary for Maven itself.
  4. Add %M2_HOME%\bin to environment PATH so that you may run the mvn command from anywhere.
By default, Maven creates a local repository under %user_profile%\.m2. To control where artifacts and dependencies are stored, specify an %M2_REPO% environment variable that points to a directory where you want the local repository.

Because I develop in the Eclipse IDE, it is configured it with the m2eclipse Maven plugin, which allows me to void a DOS console when I build projects and do everything in Eclipse:
  1. In Eclipse, create an update site for m2eclipse [Help > Install New Software. Add m2eclipse=http://download.eclipse.org/technology/m2e/releases.
  2. Select "Maven Integration for Eclipse", click [Next]. Agree to license terms and [Install]. You will need to restart Eclipse.
Before you start using m2eclipse, it pays to look over the configuration. Among the things I changed: having the plugin use the Maven installation from earlier because the plugin references non-release or snapshot version of Maven. If you have other programs or scripts that use Maven outside Eclipse, this action promotes build consistency. Also consider the settings file, which you can now edit in Eclipse.

Some recommended reads on Maven2 can be found at http://maven.apache.org/articles.html. I like "Maven 2: Effective Implementation" because it also touches on Apache Archiva and Continuum. Otherwise "Apache Maven 3 Cookbook" will get you up-to-date on the latest usage of Maven.

Tuesday, September 06, 2011

Recipe#4: Install an SVN Server

Even if you are the sole programmer on any project, it is imperative that you use version control for your source code and documentation. I use Apache Subversion (SVN) for, among other things:
  1. Be able to revert to a previous version of an application, either because my current working copy is corrupted or full of unanticipated bugs.
  2. Sharing the project with other developers for collaboration or contribution.
  3. Maintaining multiple branches or tagging code at specific milestones.
To use SVN in development, you need an SVN server and SVN client. I use Visual SVN for the server component, installed on a separate machine than what I use for development. VisualSVN is easy to manage and configure, but I mostly like its ability to authenticate via Windows users or your own creations, and access to the checked-in artifacts over HTTP(s) (browser and clients).

On why you have no excuse for not using source versioning:
http://betterexplained.com/articles/a-visual-guide-to-version-control/
http://www.relisoft.com/co_op/whyvcs.html
http://www.mactech.com/articles/mactech/Vol.14/14.06/VersionControlAndTheDeveloper/index.html
http://jamesmckay.net/2009/06/why-would-anyone-not-use-source-control/
http://www.soundsoftware.ac.uk/why-version-control

Thursday, September 01, 2011

Recipe#2: To Start Developing In Java

To start any Java project, you need to install a Java Development Kit (JDK) on your computer. The kit contains the virtual machine (JVM), the language spec, and a number of other utilities. Only three things need be done to properly install a JDK:
  1. Download the latest J2SE from http://www.oracle.com/technetwork/java/javase/downloads/index.html and run its installer.
  2. Configure the environment variables so that your installation is available on the system classpath. In either PATH or CLASSPATH, add %install_directory%\bin. At the commandline, you should be able to run java -version and see version information.
  3. Create a JAVA_HOME system environment variable and point it to the directory where the JDK is installed. Plenty of Java tools, plugins, applications, and utilities expect this variable to exist.
At this point, you can start developing Java code (using any text editor and the shell/commandline). A word of caution: although Java SE7 has some great new features, some have observed a few drawbacks. Ref: "Java SE 7 'Buggy,' Causing Crashes Says Apache Lucene".

Tuesday, August 30, 2011

Recipe #1: 12 Commandments of a Java Developer

There are only two requirements to become a Java programmer: (1) know the Java programming language, and (2) have an environment in which to program. The first requirement can be achieved through the many tutorials, books, and college courses that exist today. The environment is as simple as a computer with the JDK installed.

To become a well-rounded developer, however, requires much more than programming. Here are my 12 commandments of software development:
  1. Know development paradigms and the software development models. Practice good software development methodologies.
  2. Know the tools of the trade, including IDEs, frameworks, plugins, and other utilities that will make development easier and automated.
  3. Do not reinvent the wheel: there are developers that have likely solved the problems you will face. Use that body of work, build on it. (And contribute). Specifically, there are tons of libraries out there for all kinds of things.
  4. Have project management skills to carry a project from statement/requirements to deployment/maintenance. You have to know everything that affects what you will produce.
  5. Have an industry certification such as the Java certification from Oracle. You should also have evidence of training in other products you are training on.
  6. Diversify your skills. Be able to develop for various platforms (desktop, web, mobile), use related technologies (networking, databases, integration solutions such as ESB), and know best practices.
  7. Network with other software developers and programmers. This is how you will learn undocumented techniques and perhaps land contracts.
  8. Contribute to the knowledge base through blogging and reviews of others' work. If you invent a wheel, consider open-sourcing it. Find a few good forums and respond helpfully to topics there. Be an expert in your craft and share the wealth.
  9. Stay in the know: technology news, research, and software development publications will keep you abreast with what's going on in the world -- and believe me, it affects your craft.
  10. Practice and keep learning: there is always new ways to do things, or new products that could simplify your work. Learn their implications for you. You stand a better chance of landing that job if you can also demonstrate your skills (by perhaps showing something you have developed).
  11. Write efficient and highly optimized code, with good documentation. Test your stuff before you release it. This means that you can write good algorithms and have in place a way to test all your code paths.
  12. [Minor]: know how to setup the JVM, including the various options required for it to perform optimally.

Monday, August 29, 2011

Finally, Returning To Blogging

Yes, it's been ages since I blogged here. Over the next few weeks, I'll be cleaning up this blog (removing personal posts and focusing the blog on technical content, including software development and running a business). Personal posts will be moved to another blog.
The intent of this blog will be to share my experiences and challenges (and solutions, of course) from the world of software development, which is my current occupation.