Wednesday, October 26, 2011

Apache Ivy

In researching Apache Ant and how to create a build.xml file, I discovered Apache Ivy. Apache Ivy is a dependency manager that can easily be integrated with Apache Ant.

The main and most frequent way to use ivy is from an ant build file. However, ivy can also be called as a standalone application. If you use ant version 1.6.0 or superior, you just have to add ivy namespace to your project (xmlns:ivy="antlib:org.apache.ivy.ant") attribute of your project tag, and you can call ivy tasks.
 <project name="sample" default="compile" xmlns:ivy="antlib:org.apache.ivy.ant"> 
The build will use Apache Ivy to download, install, and manage third party libraries of the different tools needed for the project. The retrieve task copies resolved dependencies anywhere you want in your file system. Below is an example of adding checkstyle to the project.
1:  <target name="install-checkstyle" description="Install checkstyle."> 
2: <ivy:retrieve module="checkstyle" organisation="com.puppycrawl" revision="5.4" pattern="${basedir}/lib/checkstyle/[artifact].[ext]" sync="true" conf="bundled" type="jar,report"/>
3: </target>

Tuesday, October 18, 2011

Build System

The build system is extremely important. It provides a standardized way for anyone to build the system. Users can build and test the system without an IDE. Developers can build and test the system using their IDE of choice. This automated build is helpful in preventing errors, testing, and deployment. Developing a robust build system can ease the process when maintaining a large and/or complex software system.

My build system will need to become a template. As a template, I can adapt it to any project I create. The build system will be modular and extensible to become as big or as small as needed. It will integrate any third party build tools. It will handle junit, checkstyle, and any other third party build tools that the build system requires. It will be able to download, install, and manage all third party libraries needed. It will support web application development.

Below is the beginnings of a build file. It contains two targets, clean and compile. It's very simple in what its doing. I am studying the Ant manual to learn how to integrate the third party build tools and libraries into the build system.

1:  <project default="default">
2: <description>
3: The build file.
4: $Id$
5: </description>
6:
7:
8: <property name="src.dir" location="${basedir}/src"/>
9: <property name="build.dir" location="${basedir}/build"/>
10:
11:
12: <target name="clean"
13: description="Delete build/ directory.">
14: <delete dir="${build.dir}"/>
15: </target>
16:
17: <target name="compile"
18: description="Compiles the code.">
19: <!-- Ensure that the build output dir exists. -->
20: <mkdir dir="${build.dir}/classes"/>
21: <!-- Now compile the system. -->
22: <javac srcdir="${src.dir}"
23: destdir="${build.dir}/classes">
24: </javac>
25: </target>
26: </project>

Thursday, October 13, 2011

Configuring My Java Build Environment

In my efforts to improve my programming skills, I have decided to get back into Java programming and building large projects. My previous involvement with a large Java project was seven years ago as a university of Hawaii student with the CLEW system. The Collaborative Educational Website (CLEW) was a web application development framework for collegiate department websites.

Environment Configuration

The current laptop I will be working on is a Toshiba Satellite A505 running on Windows 7 64-bit. It has a 1.60 GHz processor, 4 GB RAM, and over 100 GB of free space. My first step is to create a high quality Java software development environment. I downloaded and installed the Java 7 JDK and JavaDoc documentation. I added %java%/bin to my computers PATH variable. I downloaded and installed the Eclipse 3.6.2 IDE. I chose "Eclipse IDE for Java EE Developers" to work on the Java projects. To improve the performance of Eclipse, I modified some runtime options. Increase the heap space for Eclipse. I have at least 2GB RAM. In the eclipse.ini file, I changed -Xms=40m to -Xms=512m and -Xmx=512m to -Xmx=1024m.

To verify my configuration was working, I wrote a couple of basic programs in my eclipse IDE. I wrote the generic HelloWorld program that worked fine. I wanted to try something else so I searched online and found a simple program to implement called FizzBuzz. FizzBuzz is a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". I was able to implement a working FizzBuzz program. My initial configuration was working.

Build System

This is the point in my configuration where I am stuck. The build system I used for CLEW included apache ant, jakarta tomcat, junit, checkstyle, and other tools. Are these tools still relevant?

In my research for build tools, the top two I came across were Ant and Maven. Ant is open source, Java-based, extensible, and uses XML configuration files. Maven is project management technology that uses convention over configuration. Ant is still very popular and I am familiar with the Ant concepts. Every project requires an Ant build file, build.xml. Each build file is composed of targets. Each target is composed of tasks. And targets can have dependencies.

I downloaded and installed Apache Ant 1.8.1. I added %ant%/bin to my computers PATH variable.

Now What?

Next in configuring my Java build environment will be to include the different tools to help build a working project. I will look into junit, checkstyle, and other tools currently being adopted. When I get a build environment up and running, I will begin my Java programming.

Thursday, January 13, 2011

Learning by Doing

After graduating from the University of Hawaii, I fell into a programming funk. I didn't know what to do, how to get started, or where to get help. I felt like none of the courses I took prepared me to take a project from development through to distribution. I missed not having access to Professors, TA's, classmates, and friends. I finally took action and contacted my mentor for guidance.

His advice was to just start hacking. Do anything. Think of an idea and try to implement the program. Work by trial and error. If you encounter an error, try to figure it out with research and fix the problem. There is no better way to learn then to just do it.

I found the following on a website the echoes this sentiment.
Program. The best kind of learning is learning by doing. To put it more technically, "the maximal level of performance for individuals in a given domain is not attained automatically as a function of extended experience, but the level of performance can be increased even by highly experienced individuals as a result of deliberate efforts to improve." (p. 366) and "the most effective learning requires a well-defined task with an appropriate difficultly level for the particular individual, informative feedback, and opportunities for repetition and correction of errors." (p. 20-21) The book Cognition in Practice: Mind, Mathematics, and Culture in Everyday Life is an interesting reference for this viewpoint.
This concept of learning by doing would have been nice to have done while at UH. Looking back I feel my focus was more on completing assignments before the due date to get the best grade to pass the class to get to graduation. I didn't immerse myself into the subject to fully understand it and relate it to a real world problem. Because of this, I didn't have the right mindset or ask the right questions. I would've liked to learn by doing with the class, during class, with the professor giving feedback and correcting errors as he instructs. My ideal situation would've allowed more natural learning and less lecturing.

I've been thinking a lot about my student self. I feel I approached learning all wrong. I put more effort into getting through my courses then being in the moment and participating. I've come to realize my goals were geared towards doing what I needed to do to move up instead of understanding the material. It would've been amazing to be given a difficult task and allowed to fail without the consequence. My failure would have been an opportunity to teach me where I went wrong and how to correct the mistake for next time instead of failing me with no idea or explanation why my work was unsatisfactory and forced to retake the course.

It wasn't all bad. I had a few courses that allowed me to learn by doing. We worked on real world projects. I was able to receive informative feedback and correction on errors. In one of these classes I was introduced to pair-programming. Pair-programming is a great concept.

Over the past year of I've been learning a new programming language and hacking away implementing a variety of programs. I am gaining a deeper knowledge of Ruby on Rails, CSS, and XHTML. In this process I'm learning more about utilizing the MySQL database, how the MVC paradigm works, how to work with plugins and gems, authentication, uploading images and videos, dynamic select menus, and many more things. I am coming to the conclusion that a year of learning by doing has given me a better understanding then the majority of Computer Science courses I took at UH. Out of the 15 or more ICS courses I took during my time at UH, only two were helpful, ICS 413 and ICS 414.

I will be continuing my learning by doing. My current project is a web application using Rails. My ultimate goal is to get my webapp online. I also plan on getting back into Java development. My last foray with Java was using the Struts web application framework, eclipse, ant, tomcat, mysql, and cvs. I will be looking into what I need to develop with Java and if any of the preceding tools are still relevant.

Thursday, December 16, 2010

Whatcha Been Doin? A Conversation

It's the holiday season and we are visiting with family and friends. We are out gathering with people at parties or games or whatever. While hanging out with everyone we talk to each other.

One of the early questions asked to begin a conversation is "what you been up to lately" or "what do you do." I've participated in and listened to some conversations that began this way. Over the past month I have engaged in a dozen or so conversations and listened to a bunch more that began this way. I will note that I am not the best conversationalist.

When family, friends, or strangers came up to me and ask me that question, I fill them in on the hacking and trading I've been doing. I get two responses to my answer, "that's great" and they walk away or "that's great" and they change the subject. I did not get one person to pursue further into what I'm doing or exhibit any interest in what I've said. I've come to the conclusion that it could be one of two things, 1) hacking and trading are not interesting for the people I talked with or 2) my delivery in explaining what I'm doing was not clear and understandable for anyone to continue with that conversation topic. I believe the problem is with the latter.

In listening to other similar conversations, the response was much different. The questioner was engaged with the answers and continued with follow up questions to gain a deeper knowledge of the subject. I too became fascinated with what people are doing.

So, I've been trying to figure out why my delivery failed. As I noted earlier, I am not the best conversationalist. I don't participate in many conversations because I have a weak and soft voice and many people have a difficult time hearing me, especially in loud areas. I wing it every time I tell people what I'm doing so its probably not succinct and a little confusing. I need to practice.

I'm looking to improve in this area. In my research I've come across the concept of Branding. I will be working on Brand Me. I want to be able to articulate what I'm doing better. Maybe then I will get people interested in learning more.

Monday, October 4, 2010

The Past Couple of Weeks

My mom came up to me and said, "do you realize for the past couple of weeks you've been on the computer from the moment you get up until the time you go to bed." I did not realize that. I've been so focused on what I've been doing, time has flown by. I am enjoying the work I am putting my time and effort into. All I've been doing is trading and hacking. I want to get better in these two disciplines.

I spend time on my trading looking at charts for patterns, support and resistance levels, and direction. I look back at my previous trades to check if I'm following my trading rules. I do research for my trading journal project.

I spend time on my hacking working on my project. I'm teaching myself Ruby on Rails. My Rails web application is for a youth club basketball team. I can add players with an image and their information. I can add leagues with each league having many games. I can add albums with each album containing many photos. I have a calendar that shows the current month that I can add events to which will show up for that day. I can add stats for each player that corresponds to a game. I add basic stats and the model does the calculations for individual and game stats. I am currently working on adding videos to my web application. I've used plugins and gems. I'm also learning and using CSS. When I encounter a problem I search for a solution, which can happen in a day or a month. This is FUN!

I wasn't actually on the computer all day, it just seems that way. I took some time to watch the Blue Angels. I took a couple hours here and there to go watch my nephews play basketball and football. But then I'm back on the computer. So much fun.

Saturday, October 2, 2010

The Process of Finding Standout Ideas

How do you know if you have a blockbuster idea? As an example, is my Trading Journal idea a standout idea?

Some people have said to "just get started" on your idea and you'll discover if it's a blockbuster idea. Is that the best move? I read an article The Idea Virtuoso... that touts the process that university professors of research labs use to find the best idea. Having deep knowledge and expert feedback can differentiate between mediocre and great ideas. This reminded me of Dr. Johnson being awarded a grant to research the smart grid. What was his process to settle on that idea to get awarded that grant?

It seems like meeting with a group or team to brainstorm and discuss all ideas are needed to identify the best possible projects before getting started. This commitment to understanding the idea and seeking feedback will help you follow ideas you feel have a strong possibility for success.

It's called the idea-centric approach. You research your ideas to discover if there is an audience out there that sees value in an idea. When the standout idea emerges, the focus of your efforts goes toward implementing that idea. In this approach, you need to learn or know the field and seek expert advice.