Friday, October 31, 2014

Let the Embryo Grow

Please review file input and output using buffering, XML parsing, and reflection. Those will be the next three stages of growth for this embryo. One Monday, we will evolve this source so it serves up the selected HTML.

Thanks all for now, Team. La-La.

Thursday, October 30, 2014

Planting an Embryo

As promised, today we will create the embryo of our general purpose servlet. First, we must discuss licensing. The open-source project materials found at java.net, blog content, and source code here are under the SCSL 3.0 license found at ( http://jcp.org/aboutJava/community/process/SCSL3.0.rtf ) and copyrighted by the author, Jody Sharpe.

The embryo is in the form of a simple JAVA class. It was created in NetBeans and is below. The output is an HTML file.

//START SOURCE CODE
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cab;
/**
 * The CAB will eventually for the kernel of the CABOOSE general purpose servlet
 * @author Jody Sharpe
 */
public class CAB {
    //Simulated URL String. We will eventually get all of our input from the
    //the servlet,s Request object.
    String request = "?project=caboose&module=skeleton&create_date=10.30.2014";
    //Simple response in the form of an HTML page. We will supply any response
    //via the servlet's Response object.
    String response = "<html><head><title>CABOOSE Embryo</title></head>" +
            "<body>#PROJECT#<p>#MODULE#<p>#CREATE_DATE#<p></body></html>";
   
    java.util.Map<String,String> mappingRequestNameValuePairs( String request ){
        java.util.Map<String,String> aMap = new java.util.Hashtable<String,String>();
        request = request.replace("?","");
        String[] theNameValuePairs = request.split("&");
        for( String aNameValuePair : theNameValuePairs ){
            final int theName = 0, theValue = 1;
            String [] aTuple = aNameValuePair.split("=");
            aMap.put( aTuple[theName], aTuple[theValue]);
        }
        return aMap;
    }
   
    String preparingResponse( String stencil, java.util.Map<String,String> aRequestMap ){
  
        stencil = stencil.replace("#PROJECT#",aRequestMap.get("project"));
        stencil = stencil.replace("#MODULE#",aRequestMap.get("module"));
        stencil = stencil.replace("#CREATE_DATE#",aRequestMap.get("create_date"));
       
        return( stencil );
       
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        CAB aCAB = new CAB();
        java.util.Map<String,String> aRequestMap = aCAB.mappingRequestNameValuePairs( aCAB.request );
        System.out.println( aCAB.preparingResponse( aCAB.response, aRequestMap) );
    }
}
//END SOURCE CODE

That is it. Copy, compile, and run it. Remove the package statement if necessary. This is enough for now. While working on a graduate degree in software engineering, my instructors repeatedly presented research which stated that most fulltime professional engineers only produce 20-30 lines of verified and validated code in a day. So, we have accomplished reasonable amount for part-timers in a day.

I apologize for the late post. This morning was hectic since it is time for the monthly billing cycle.
Speak with you later, Team. La-La.

Wednesday, October 29, 2014

Preparing for the project.

Today will be a short post. In the previous post, we have had a short discussion of the technologies with which you must be comfortable so you can follow this project. We have also looked at some books which might assist you in learning what you might lack. What we have discussed so far is the technologies for what is called the middleware and back-end. The front-end of the project will be created using XHTML, CSS, and possibly JavaScript (EMCAScript). For brief tutorials on these topics, see http://www.w3schools.com/ and review the appropriate material.

Tomorrow we will code the skeleton of our project. It will not seem like much, but the longest journey is started with a single step.

La-La.

Tuesday, October 28, 2014

Getting up and running.

Hopefully, you have read the Wiki of the CABOOSE project on java.net at this point. It is my sincere prayer that your head is not swimming. I believe in keeping things simple so they might  be accessible for the largest possible audience. I spent a "good" hour preparing a post for this morning between 9:30 PM and 11:00 PM last night. It contained a long treatise on education, research, the KISS principle which is an acronym for Keep It Simple Stupid. Then I realized the my post was somewhat ironic!

I learned the KISS principle in my first class on computing. Being that we should become a kinder gentler world, this acronym has been shorten in recent years becoming KIS, Keep It Simple. Beside the acronym, this post has been shortened, because you certainly are not interested in spending thirty minutes reading it.

If you had some questions after viewing the WIKI, I have some reading for you. I remember some of my early years as a software engineer before I earned my degree and learned most of the "computerese". My head would also spin when some of the senior staff started discussing projects of which I could not makes head nor tails.

If you are interested in following the CABOOSE project and things such as computer programming are new for you, I would recommend reading Roberts' The Art and Science of JAVA. This is likely the best book on JAVA programming for the computing neophyte. It provides an excellent academic treatment. There are also free online lectures and exercises associated with this book at the Stanford SEE site (http://see.stanford.edu/see/courses.aspx). Choose course CS106A. I have used these as adjunct lectures for some of the JAVA courses which I taught.  See if you can pick up an inexpensive edition of the book on Amazon. It is usually somewhat pricey since it is used at many colleges and universities. Another downside it that it requires the use of a special library of software which you must install in the program which you use for writing JAVA applications. The library and the program are freely available on the web, but, if you do not have much experience with using a computer, you might have trouble installing these. I might post some notes on this later although I believe it is covered in the book.

For the accomplished professional programmer who is interested in following this project and does not know JAVA, I would recommend, Schildt's JAVA, A Beginner's Guide. It is about a full weekend's worth of reading or one can easily finish it in a week's worth of television time. If you desire, there is an advanced version of this same book which you can read after completing the first.

For the neophyte programmer, I would not expect that you finish your book in a week.  A chapter per week would be an excellent pace that would keep you ahead of the curve. Most professional programmers use languages with approximately forty special words in them. The task of learning a new command-based language is learning the forty words in the new language and how one might say in this language a sentence from one's old language. So I expect that the accomplished developer would have a shorter learning curve.

For those who are comfortable with programming language concepts, do not mind sitting at a computer reading, and enjoy the nonlinear nature of the web, there is the JAVA Standard Edition Tutorial at Oracle (http://docs.oracle.com/javase/tutorial/).

These books and the tutorial are more reading than one can do in a day. Take your time these pages will be here for a while.

Also, I would not recommend the Deitel book on JAVA especially for the programming neophyte. The Deitel group wrote excellent academic texts for freshman on C and C++, but they missed the mark on JAVA. JAVA is more than a language. It is a set of prewritten software libraries that provide features for web and graphical user interface development among other things. Unfortunately, the Deitel text tries teaching one how the can gallop and skip before they can crawl, walk, or run with JAVA. A new student would be best served learning JAVA language fundamentals instead of applet or window form creation.

Plus, computer programming is an application of computer science. Most modern college students learn programming before they take a course in computing theory. This is gallop-crawl backward. One should learn the abstractions before the concrete details. Unfortunately, computing theory is mathematically intensive and most books on the subject are littered with cryptic notation that only the mathematically sophisticated can read. Fortunately, a fellow who has this level of sophistication Michael Sipser wrote a book on theory that uses plain English descriptions for explaining theory. His book on the Theory of Computation is the most accessible that I have found so far. I would suggest getting a copy for your own personal enrichment if you are an undergraduate student or missed this course during your training in computing. Also, an inquisitive and industrious high school student might fair well with his book. CABOOSE will not discuss many topics in theory other than the concept of general purpose computing.

Other topics which the CABOOSE project will require as a pre-requisite are the fundamentals of software architecture and development lifecycles. In particular, we will be using a layered and model-II model-view-controller architecture. So, become familiar with these. Also, I will be using the evolutionary model of development. I will not throw away the first iteration of software, the prototype. I will evolve it. This counters the thinking in some very classic software lifecycle models. So, become familiar with this lifecycle model plus the Waterfall model. You simply should have a basic understanding of the Waterfall. It is a common lifecycle process in all problem-solving, and software engineering is an exercise in this. If I find some simple, well-written tutorials on these topics, I will post the web addresses. I hope that I have kept my promise and kept it simple. This post only took a third of the time as my original one. I hope that it was less than a thirty minute read.

Speak with you later, Team. La-La.

Monday, October 27, 2014

What's a CABOOSE

CABOOSE is a daily weblog and an exploratory tutorial about the process of creating an open source project. Hopefully, we can learn much as a team along the way, and you, as an individual, can learn from the successes and failures which occur.

A CABOOSE can be created in any number of language which support the dynamic invocation of methods, functions, procedures, modules, or subroutines. It is highly applicable in the web-space, but can be useful in the areas of graphical user interfaces, report generators, and anywhere one might use a layered Model-II Model-View-Controller architecture when creating a software system.

Before one can fully appreciate this weblog, he should have an understanding of the JAVA programming language. If you are comfortable with using the most common keywords in the language, creating and invoking methods, extending an object, and access modifiers you should be fine. These are the concepts that many students learn in a modern freshman course in computer science as a core requirement or elective for a bachelors degree in computing. Also, you should become comfortable with using the reference materials available at Oracle for JAVA 6, 7, or 8. And, I hear that 9 is on the way. One can find the references for the latest JAVA 8 Standard Edition (JSE) at http://docs.oracle.com/javase/8/docs/api/. We will also be using the JAVA Enterprise Edition (JEE). You will find the class reference for the JAVA 7 Enterprise Edition at http://docs.oracle.com/javaee/7/api/.

Seeing that there are over 4000 classes with numerous methods found in these references, do not expect that you can memorize them all. Simply be comfortable with using them the way one would use a dictionary.  Look-up terms when you come across one you do not understand or when you are looking for a particular term usage that you must use but cannot recollect.

Also, as a prerequisite become familiar with basic software engineering terms, especially those surrounding software architecture and life-cycle processes. If you do not know all of these things yet, but are interested in learning, this weblog is also for you. If you be interested in posting any questions visit the project page at https://java.net/projects/caboose and join the mailing list or post a question in the forum. They will be answered as resources become available. Also, if you are interested in finding out exactly what a CABOOSE is read the WIKI at the project pages.