Wednesday, September 15, 2010

Global Economy...Good or Evil?

Everyone's talked about it for a long time. Programmers have been scared that their jobs will soon be gone. Executives have been salivating at the thought of getting a super smart programmer for less than the US minimum wage. The globalization of software development. I had an interesting conversation about this with a colleague and friend yesterday and some interesting points came up. Free trade.

Generally speaking I believe most people think that free trade is a good thing. It promotes competition and as a result the quality of products. My friend, who shall remain unnamed =), believed that only good could come out of outsourcing. He looked at it from the perspective of pure scientific benefit. The more the competition is for skilled software professionals, the more skilled the profession of software development would naturally become. I can't say that I disagree with this in the slightest. However, this is looking at the issue from a simple, and in my opinion rather naive perspective...

It assumes that all things are equal. That all other aspects do not factor in. In my opinion nothing can be further than the truth. First, the concept of quality. Quality is hard to measure in software. Bugs are of course not related to quality but rather unintended behavior from a functional perspective. Quality, in software engineering, is more associated with non-functional requirements or quality attributes. These are the 'illities.' For example, scalability and modifiability are very highly dependent on the micro-architecture and detailed design of a system. The structure design. This, of course, disappears when a system is compiled. The outside world cannot tell the difference between a well architected system and a poorly architected system. This means that executives cannot tell the difference. They can 'feel' the difference in an indirect, ambiguous way somewhere down the line. What results from that 'feeling' is a rabbit hole in of itself! Either way the only people who understand this quality are technical people and what executive is going to listen to them! After all they could be just lying to save their jobs!

Another aspect is pay scale. Software professionals are highly skilled people. I would go as far as saying their among the elite of the skilled professions. They usually have BS and MS degrees from rigorous academic programs. As a result, they are usually well paid. In a global economy this gets skewed. 15-20K a year job in the states is typically a dead end job requiring no skills or education. However, this amount in a third world country is great!

Some would argue that this is the same as the outsourcing of traditional manufacturing that happened in the late 70's and 80's. I would argue that in spite of the superficial similarities of labor and reducing costs of labor this is very different. Engineering and Computer Science are disciplines and are critical to the growth of society. The US way of life is what has inspired such growth in these fields. When our way of life changes, and it inevitably will as a global economy means a global way of life, so will the growth in the fields.

So is global economy good or evil? I guess we will just have to wait and see...

Tuesday, September 14, 2010

Creating a "Fat Jar" using Maven

UPDATED 11/28/11 to use latest assembly plugin!

A while ago, before I really started playing with maven, I wanted to create a jar that would package up all the libraries it used and be a single entity that I could invoke. So some searches yielded the eclipse plugin "Fat Jar." This was all nice and great but how could one do this without eclipse? Well maven let's you do this rather easily. Check out the pom.xml file below


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.orphanware.mv</groupId>
    <artifactId>mv-session-mgr</artifactId>
    <packaging>jar</packaging>
    <version>1.1</version>
    <name>mv-session-mgr</name>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <fork>true</fork>
                    <executable>/usr/lib/jvm/java-7-openjdk-amd64/bin/javac</executable>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                  
                </configuration>
                <executions>
                    <execution>
                        <id>assemble-all</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>            
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.tiger</groupId>
            <artifactId>mvapi</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
        </dependency>

    </dependencies>
    
    
</project>



Of course the code above is for a project I was working on so don't pay too much attention to the specifics. The part we care about is the:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                  
                </configuration>
                <executions>
                    <execution>
                        <id>assemble-all</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


That is how it will package it into a jar with what you named the artifact and it will append the descriptorRef to it.

Now you can build it with

mvn package

Thats it!