Difference between revisions of "Quick-and-Dirty Guide to Transforming the Bank Application into your Very Own Project"

From Wiki**3

(The Core Library: po-bank-core)
(The Core Library: po-bank-core)
Line 78: Line 78:
 
Note that this is the main library, i.e., the one containing classes that make a bank application and all the corresponding functionality. Very little will be directly reusable in the OOP course project, but the relationship between this library and the others in an application remains the same across applications. This means that a different core will exist in some other application, but its role will be the same played in the bank application by '''po-bank-core.jar'''.
 
Note that this is the main library, i.e., the one containing classes that make a bank application and all the corresponding functionality. Very little will be directly reusable in the OOP course project, but the relationship between this library and the others in an application remains the same across applications. This means that a different core will exist in some other application, but its role will be the same played in the bank application by '''po-bank-core.jar'''.
  
Note that '''po-bank-core.jar''' does not depend on any other library but itself. This is exactly the same for any other application (the core is always autonomous). Thus, if you need extra dependencies, you are (most likely) doing something wrong and should seek informed help.
+
Note that '''po-bank-core.jar''' does not depend on any other library but itself (in the sense that it does not depend on the user interface libraries -- even though it might depend on libraries providing specific functionality, such as tax computations). This is exactly the same for any other application (the core is always autonomous). Thus, if you need extra dependencies, you are (most likely) doing something wrong and should seek informed help.

Revision as of 18:47, 24 October 2010

The bank application is very small and simple. Nevertheless, it already incorporates all major components needed for a larger application.

The following is a quick guide to start your project from the Bank sources.

The Goods

The following are the components of the bank application (these are the 2010/2011 editions):

Each package includes a makefile to compile and build the corresponding JAR archive. Note that the makefiles assume that all JAR dependencies reside in /usr/share/java (linux installation -- other environments may, and indeed should work, but are not covered in this text).

The bank application has a similar structure to the one needed for the OOP course programming project (but... be careful).

Simply Compiling and Running the Application

This first part documents the steps needed to obtain a runnable version of the bank application.

It is important to understand each step and the role played by each library in the final project. This way, you can make surgical changes to the code and transform it in useful ways (e.g., to reuse it in similar projects).

The Abstract User Interface Library: po-uilib

First and foremost, note that this library does not need to be changed. If you think it does, either you found a bug (unlikely, but you never know...), or you are doing something wrong. In either case, seek help before proceeding into certain oblivion.

To unpack, compile, and install the user interface library, do the following:

 tar xvfj po-uilib-201010151128.tar.bz2
 cd po-uilib-201010151128
 make

If you are unlucky enough not to have GNU tar, try it this other way:

 bzcat po-uilib-201010151128.tar.bz2 | tar xvf -
 cd po-uilib-201010151128
 make

Note that there is no "make install" command (the makefiles don't have that rule). To install, simply copy the po-uilib.jar file to some directory. Remember the name of this directory: we will simply call it JAVADIR. All makefiles assume that this directory is /usr/share/java (the default place for JAR files in Linux). However, you can put JARs anywhere. To change the place, simply do:

 JAVADIR=/some/other/directory/i/prefer/to/use/for/my/jars

This line can be set directly in the makefiles. Note that you will need writing privileges in that directory. If you have an RPM-based distribution, the following repository has up-to-date versions (example for openSUSE 11.3):

Other distributions may become supported (but remember: tests are run only on openSUSE 11.3). Check:

The Strings Library: po-bank-strings

Similarly, to unpack, compile, and install the strings library, do the following:

 tar xvfj po-bank-strings-201010211032.tar.bz2
 cd po-bank-strings-201010211032
 make

Note that po-bank-strings.jar depends on po-uilib.jar: you will have to set JAVADIR in the makefile (as explained above).

As before, install it by copying po-bank-strings.jar to JAVADIR (the place where you put po-uilib.jar).

In the OOP course project, a different strings library is, of course, needed. The role played by po-bank-strings.jar in the bank application will be played by po-grt-strings.jar in the grt application. Note that you won't reuse any of the bank application's strings and will simply replace one library for another.

The Core Library: po-bank-core

Similarly, to unpack, compile, and install the core library, do the following:

 tar xvfj po-bank-core-201010211032.tar.bz2
 cd po-bank-core-201010211032
 make

As before, install it by copying po-bank-core.jar to JAVADIR (the place where you put po-uilib.jar and po-bank-strings.jar). We go through the installation procedures because we assume that the core can be used by any number of applications.

Note that this is the main library, i.e., the one containing classes that make a bank application and all the corresponding functionality. Very little will be directly reusable in the OOP course project, but the relationship between this library and the others in an application remains the same across applications. This means that a different core will exist in some other application, but its role will be the same played in the bank application by po-bank-core.jar.

Note that po-bank-core.jar does not depend on any other library but itself (in the sense that it does not depend on the user interface libraries -- even though it might depend on libraries providing specific functionality, such as tax computations). This is exactly the same for any other application (the core is always autonomous). Thus, if you need extra dependencies, you are (most likely) doing something wrong and should seek informed help.