Team. The next season of teaching offers four "lecture" courses. This includes a programming fundamentals course in Python for an international on-line distance education program, a couple of remote delivery courses for a local community college, which likely will include an information literacy course, and a freshman computing elective at a local Jesuit university. Over the next few weeks, the author must prepare himself for this upcoming term. A couple of these "specific" courses the author has not taught previously, although he has given many similar lectures. He could enter each class session and "wing it", but that does make for the occasional "poor" performance.
The long and the short of it is this, he must postpone work on the fourth phase of this project. Which is about a 16.0 PH coding effort. It also requires refreshing some "long-forgotten" programming skills in C. Many of the modern languages, such a JAVA, C#, and etc., provide memory management under the hood and automatically allocates space as needed plus comes bundled with many useful data structures.
And, although this effort's goal is providing a "proof of concept" prototype for the CABOOSE controller pattern and not an "optimized", "professional-grade" solution, each language's object file should handle a reasonably-sized input. This includes the one created in C, whose language features for dynamically resizing data structures is "messier" than many other "more modern" languages.
So, we will plan on delivery of this phase by 08.31.2020, and the final multilingual project in fourteen "unique" languages well-before 01.01.2021.
Keep Coding Like a Bird-Brain. Hunt...Peck...Think...And, Let HIM Provide.
[Mat 6:26 KJV] 26 Behold the fowls of the air: for they sow not, neither do they reap, nor gather into barns; yet your heavenly Father feedeth them. Are ye not much better than they?
Tuesday, July 28, 2020
Friday, July 10, 2020
[ Meta is Betta ] - Architectural Language for Controllers - [ The Compiler ]
Team. During a previous entry in this web history, we defined a "meta-language" for controlling a simple CABOOSE controller. As described in the text CABOOSE in JAVA by Abraham Vati James, these control files were specified using eXtensible Markup Language (XML).
When we started the implementation of this controller pattern for this multilingual project, we decided that we would use the simplest approaches available. The modules which process XML in these languages were not well-known; yet, it seemed that using them would produce a "wordier" solution than describing the control file using a format based upon Comma Separated Values (CSV).
CSV files can be properly handled with standard file processing and string functions. And, with some extra logic, our "bespoke", or custom, CSV format with sections is easily processable. It is below.
begin, views
viewId, stencil
landing, /WEB-INF/model/xstencil.xhtml
exception, /WEB-INF/model/exception.xhtml
end, views
begin, placeholders
?We can even implement comments on all lines prefixed with a "single" question mark
viewId, placeholderId, class, method
landing, #PROJECT#, org.sharpe.sample.StencilHandler, projectRenderer
landing, #MODULE#, org.sharpe.sample.StencilHandler, moduleRenderer
landing, #CREATE_DATE#, org.sharpe.sample.StencilHandler, createDateRenderer
landing, #HIBERNATE_MESSAGE#,org.sharpe.sample.StencilHandler, hibernateMessageRenderer
landing, #JAXWS_MESSAGE#, org.sharpe.sample.StencilHandler, JAXWSMessageRenderer
landing, #JAXRS_MESSAGE#, org.sharpe.sample.StencilHandler, JAXRSMessageRenderer
exception, #EXCEPTION_MESSAGE#, org.sharpe.sample.StencilHandler,exceptionRenderer
end, placeholders
And, with the proper conditions, we can permit extra white-space for readability. This controller file came with a sample CABOOSE pattern implementation for a JAVA Enterprise Edition servlet that pulls information synchronously from a Hibernate database, a JAVA JAX WS web service, and a JAVA JAX RS (RESTful) web-service.
For our project, we likely will create a control file in this CABOOSE meta language that will populate three of four unique views and a general-use exception view. This will be a proof of concept. The above CABOOSE file produces one test view called "landing" and an "exception" page.
On the landing page, all of the #PLACE_HOLDERS# are replaced with the string returned by the class and method named on the same line. In JAVA, these classes must be in the "classpath" of the web application.
We will produce a "naive" compiler for this language. Although we will parse each line and fill data structures, such as associate arrays, dictionaries, hash tables, or maps, with the information describing the process flow, this procedure will be much simpler than generating an object file from a C or C++ file. It will not require producing machine language or byte code instructions from a high level language specification. We will simply store the processing logic in data structures that will permit near instantaneous access. So, when one request a "view", its specification in HTML can be quickly found within the storyboard model along with a list of placeholders and methods which will replace them with content strings.
This compiled logic will depend upon the use of dynamic invocation when calling the placeholder replacement methods. Dynamic linking is a "tad" bit slower than the static linking that commonly is done. Yet, this approach allows for a much better partitioning of the system concerns. However, one might create a "naive" code generator that builds a "well-structured" and "well-formatted" switching statement from the description found in the CABOOSE meta-language file. Its logic could contain processing for reading the appropriate view and populating it with string replacement. Plus, it could contain statically linked methods which will render the content for the placeholders.
With the use of one's imagination, he can see how a "simple" text-based menu-driven system could be built with a CABOOSE pattern and its associated language. One can also obviously see that he could build a web-based system with an HTML storyboard. And, one could be a traditional client-side graphical user interface system, if he defined a declarative of markup type language for describing the windows and forms. This is the most flexible solution for application building.
Our next phase, will see use reading in the meta language file, placing its contents in a data structure, and then echoing these contents. The plan on a three week turn around on this step, although it probably could be completed in eight hours or less be an accomplished engineer.
Keep It Simple. Happy Hunting, Pecking, and Thinking.
When we started the implementation of this controller pattern for this multilingual project, we decided that we would use the simplest approaches available. The modules which process XML in these languages were not well-known; yet, it seemed that using them would produce a "wordier" solution than describing the control file using a format based upon Comma Separated Values (CSV).
CSV files can be properly handled with standard file processing and string functions. And, with some extra logic, our "bespoke", or custom, CSV format with sections is easily processable. It is below.
begin, views
viewId, stencil
landing, /WEB-INF/model/xstencil.xhtml
exception, /WEB-INF/model/exception.xhtml
end, views
begin, placeholders
?We can even implement comments on all lines prefixed with a "single" question mark
viewId, placeholderId, class, method
landing, #PROJECT#, org.sharpe.sample.StencilHandler, projectRenderer
landing, #MODULE#, org.sharpe.sample.StencilHandler, moduleRenderer
landing, #CREATE_DATE#, org.sharpe.sample.StencilHandler, createDateRenderer
landing, #HIBERNATE_MESSAGE#,org.sharpe.sample.StencilHandler, hibernateMessageRenderer
landing, #JAXWS_MESSAGE#, org.sharpe.sample.StencilHandler, JAXWSMessageRenderer
landing, #JAXRS_MESSAGE#, org.sharpe.sample.StencilHandler, JAXRSMessageRenderer
exception, #EXCEPTION_MESSAGE#, org.sharpe.sample.StencilHandler,exceptionRenderer
end, placeholders
And, with the proper conditions, we can permit extra white-space for readability. This controller file came with a sample CABOOSE pattern implementation for a JAVA Enterprise Edition servlet that pulls information synchronously from a Hibernate database, a JAVA JAX WS web service, and a JAVA JAX RS (RESTful) web-service.
For our project, we likely will create a control file in this CABOOSE meta language that will populate three of four unique views and a general-use exception view. This will be a proof of concept. The above CABOOSE file produces one test view called "landing" and an "exception" page.
On the landing page, all of the #PLACE_HOLDERS# are replaced with the string returned by the class and method named on the same line. In JAVA, these classes must be in the "classpath" of the web application.
We will produce a "naive" compiler for this language. Although we will parse each line and fill data structures, such as associate arrays, dictionaries, hash tables, or maps, with the information describing the process flow, this procedure will be much simpler than generating an object file from a C or C++ file. It will not require producing machine language or byte code instructions from a high level language specification. We will simply store the processing logic in data structures that will permit near instantaneous access. So, when one request a "view", its specification in HTML can be quickly found within the storyboard model along with a list of placeholders and methods which will replace them with content strings.
This compiled logic will depend upon the use of dynamic invocation when calling the placeholder replacement methods. Dynamic linking is a "tad" bit slower than the static linking that commonly is done. Yet, this approach allows for a much better partitioning of the system concerns. However, one might create a "naive" code generator that builds a "well-structured" and "well-formatted" switching statement from the description found in the CABOOSE meta-language file. Its logic could contain processing for reading the appropriate view and populating it with string replacement. Plus, it could contain statically linked methods which will render the content for the placeholders.
With the use of one's imagination, he can see how a "simple" text-based menu-driven system could be built with a CABOOSE pattern and its associated language. One can also obviously see that he could build a web-based system with an HTML storyboard. And, one could be a traditional client-side graphical user interface system, if he defined a declarative of markup type language for describing the windows and forms. This is the most flexible solution for application building.
Our next phase, will see use reading in the meta language file, placing its contents in a data structure, and then echoing these contents. The plan on a three week turn around on this step, although it probably could be completed in eight hours or less be an accomplished engineer.
Keep It Simple. Happy Hunting, Pecking, and Thinking.
Tuesday, June 30, 2020
Fourth Phase Completed - Rust Problems Resolved
Team. We resolved the trouble that we were having in terms of linking in the proper external Rust library for regular expression processing. These Rust libraries are called crates. Since we are using MS Visual Code as our editor and work environment, we had been compiling the Rust portion of this project with "rustc". The author does not have any "hobbyist" or "professional" experience using some of the languages in this project, including Clojure and Rust. Each of these has a "special" tool for building projects, compiling, and running them. Clojure uses "lein" short for "Leiningen" and Rust uses "cargo". Once we found some guidance on-line that outlined the use of cargo for creating, building, and running Rust projects, we had more success and the crates were added correctly. The hard-core "Rustaceans" who might be reading this are likely saying, "Duh!".
Yet, making a long story short, we have completed the fourth phase of our simple "general-purpose" controller project which is in this incremental archive.
Hunt. Peck. Think. Enjoy This Coding Day!
Yet, making a long story short, we have completed the fourth phase of our simple "general-purpose" controller project which is in this incremental archive.
Hunt. Peck. Think. Enjoy This Coding Day!
Sunday, June 28, 2020
Tin Roof Rusted
Team. The next deliverable is about 4.0 PH from completion, conservatively. The HTML file which will be printed at this stage of evolution has a couple of placeholders that we shall replace. The Rust component requires linking in a specific library, regex. Since the author is a Rust novice, this process will require some on-line background reading. One can skin a cat in a number of ways. And, more than one method exists for linking in these regular expression(regex) subroutines. We must settle on one and get the code working. It will return the HTML with the placeholders, but we should "explicitly" replace them with "live" data. So, it has been a "Tin Roof Sunday".
Some of the source code modifications took less than 0.25 PH. Others required 0.75+ PH. The author has not regularly code the C language since 1998. And, it can be rather unforgiving for a misplaced pointers. Luckily, we found code samples which we could adapt and evolve.
Monday will be a "development-free" day. We should rap up the Rust component on Tuesday. If not, we shall deliver what we have on Wednesday as promised.
Hunt. Peck. Think. and Keep It Simple.
Some of the source code modifications took less than 0.25 PH. Others required 0.75+ PH. The author has not regularly code the C language since 1998. And, it can be rather unforgiving for a misplaced pointers. Luckily, we found code samples which we could adapt and evolve.
Monday will be a "development-free" day. We should rap up the Rust component on Tuesday. If not, we shall deliver what we have on Wednesday as promised.
Hunt. Peck. Think. and Keep It Simple.
Friday, June 26, 2020
Plans, Plans, Plans
Team. We were planning on delivering the source code in each of the fourteen languages that we are using for the fourth phase of this project. During this step, we had planned on producing code snippets that return an HTML file with placeholders that had been replaced with "live" data.
We planned on having that done by this Friday, 06.26.2020, at the end of the workday. Life interrupted this week. The author did not get a start on the code until the late afternoon of this day. He completed part of the fourteen language samples by the early evening, but he is not done.
Give him this weekend and plan on having that deliverable by next Wednesday. He has about thirty Python assignments which he must grade this Saturday. Plus, he is preparing a short course called "Working Smart: With Smart Phones" for the Training and Development Department of the junior college where he teaches, which must be done by next Friday.
It will all fall in place.
Happy Coding. The Code Rosetta Team.
We planned on having that done by this Friday, 06.26.2020, at the end of the workday. Life interrupted this week. The author did not get a start on the code until the late afternoon of this day. He completed part of the fourteen language samples by the early evening, but he is not done.
Give him this weekend and plan on having that deliverable by next Wednesday. He has about thirty Python assignments which he must grade this Saturday. Plus, he is preparing a short course called "Working Smart: With Smart Phones" for the Training and Development Department of the junior college where he teaches, which must be done by next Friday.
It will all fall in place.
Happy Coding. The Code Rosetta Team.
Tuesday, June 23, 2020
Special Control File(s)
Team. When we build the "general-purpose" controller and JAVA Enterprise Edition servlet for the do-it-yourself tutorial found in the book CABOOSE in JAVA, we used a control file. This structured file used an extensible markup language (XML) format for describing its contents and the interrelationships between its parts.
XML is a wonderful way of representing structured information and mappings between data plus the associated relationships. However, the software packages and libraries for processing XML often require "wordy" solutions. This is the case with JAVA. It seems that XML's flexibility as a file format promotes this "wordiness".
The author realized that whatever one represents in XML might also be well-organized in a relational database management system. And, programmatic database access does not require as "wordy" of a solution. Yet, we sought a simple, highly-flexible, and universal solution for our controllers. And, if we chose a particular database management system for storing this information instead of XML files, we would curtail its "range of universality".
Yet, another way of "structuring" "flat" files is comma separated values (CSV). It is a little "wordier" than XML but will not irreversibly bind a database management system solution with our "controller" kernels. So, we have a trade-off. The controller files are more "verbose" than the equivalent XML, but the programmatic solution that reads and interprets them is more "terse".
As a result of extracting the control information from an XML file, we must produce a pair of CSV files.
A sample directory.xml file is below:
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!-- the model is for the entire application. one view associates
with one page of markup. As attributes this element has an id and a stencil
which is a the filename of the markup. Each view has zero or more replacement
tile child elements associated with it. The tile id attribute appears in the
markup and will be replaced by the String content rendered by the method
uniquely described by the class and method attributes of the tile element.
-->
<model>
<view id="landing" stencil="/WEB-INF/model/xstencil.xhtml" content-type="text/html;charset=UTF-8">
<tile id="#PROJECT#" class="org.sharpe.sample.StencilHandler" method="projectRenderer"/>
<tile id="#MODULE#" class="org.sharpe.sample.StencilHandler" method="moduleRenderer"/>
<tile id="#CREATE_DATE#" class="org.sharpe.sample.StencilHandler" method="createDateRenderer"/>
<!--
Uncomment the following three tile elements after deploying and starting the JAXRSHello
and JAXWSHello web services plus creating the necessary database structure for the Hibernate operations.Take them one at a time.
-->
<!--<tile id="#HIBERNATE_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="hibernateMessageRenderer"/>-->
<!--<tile id="#JAXWS_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="JAXWSMessageRenderer"/>-->
<!--<tile id="#JAXRS_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="JAXRSMessageRenderer"/>-->
</view>
<view id="exception" stencil="/WEB-INF/model/exception.xhtml" content-type="text/html;charset=UTF-8">
<tile id="#EXCEPTION_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="exceptionRenderer"/>
</view>
</model>
landing,#CREATE_DATE#,org.sharpe.sample.StencilHandler,createDateRenderer
landing,#CREATE_DATE#,org.sharpe.sample.StencilHandler,createDateRenderer
XML is a wonderful way of representing structured information and mappings between data plus the associated relationships. However, the software packages and libraries for processing XML often require "wordy" solutions. This is the case with JAVA. It seems that XML's flexibility as a file format promotes this "wordiness".
The author realized that whatever one represents in XML might also be well-organized in a relational database management system. And, programmatic database access does not require as "wordy" of a solution. Yet, we sought a simple, highly-flexible, and universal solution for our controllers. And, if we chose a particular database management system for storing this information instead of XML files, we would curtail its "range of universality".
Yet, another way of "structuring" "flat" files is comma separated values (CSV). It is a little "wordier" than XML but will not irreversibly bind a database management system solution with our "controller" kernels. So, we have a trade-off. The controller files are more "verbose" than the equivalent XML, but the programmatic solution that reads and interprets them is more "terse".
As a result of extracting the control information from an XML file, we must produce a pair of CSV files.
A sample directory.xml file is below:
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!-- the model is for the entire application. one view associates
with one page of markup. As attributes this element has an id and a stencil
which is a the filename of the markup. Each view has zero or more replacement
tile child elements associated with it. The tile id attribute appears in the
markup and will be replaced by the String content rendered by the method
uniquely described by the class and method attributes of the tile element.
-->
<model>
<view id="landing" stencil="/WEB-INF/model/xstencil.xhtml" content-type="text/html;charset=UTF-8">
<tile id="#PROJECT#" class="org.sharpe.sample.StencilHandler" method="projectRenderer"/>
<tile id="#MODULE#" class="org.sharpe.sample.StencilHandler" method="moduleRenderer"/>
<tile id="#CREATE_DATE#" class="org.sharpe.sample.StencilHandler" method="createDateRenderer"/>
<!--
Uncomment the following three tile elements after deploying and starting the JAXRSHello
and JAXWSHello web services plus creating the necessary database structure for the Hibernate operations.Take them one at a time.
-->
<!--<tile id="#HIBERNATE_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="hibernateMessageRenderer"/>-->
<!--<tile id="#JAXWS_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="JAXWSMessageRenderer"/>-->
<!--<tile id="#JAXRS_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="JAXRSMessageRenderer"/>-->
</view>
<view id="exception" stencil="/WEB-INF/model/exception.xhtml" content-type="text/html;charset=UTF-8">
<tile id="#EXCEPTION_MESSAGE#" class="org.sharpe.sample.StencilHandler" method="exceptionRenderer"/>
</view>
</model>
First, the directory holds a mapping between the application level identifiers for the view specifications, "id", and the name of the file which holds the view's markup specification in client-side technologies, "stencil".
So, this information must be held in one CSV, under the headings viewId and stencil.
viewId, stencil
landing,/WEB-INF/model/xstencil.xhtml
exception,/WEB-INF/model/exception.xhtml
Second, the directory holds a mapping between data placeholders ids and the identifiers for the classes and methods that will render a string which eventually shall replace the placeholder in the appropriate markup stencil.
So, this information must be held in another CSV, under the headings viewId, placeholderId, class, method.
viewId, placeholderId, class, method
landing,#PROJECT#,org.sharpe.sample.StencilHandler,projectRenderer
landing,#MODULE#,org.sharpe.sample.StencilHandler,moduleRendererlanding,#CREATE_DATE#,org.sharpe.sample.StencilHandler,createDateRenderer
landing,#HIBERNATE_MESSAGE#,org.sharpe.sample.StencilHandler,hibernateMessageRenderer
landing,#JAXWS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXWSMessageRenderer
landing,#JAXRS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXRSMessageRenderer
landing,#JAXWS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXWSMessageRenderer
landing,#JAXRS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXRSMessageRenderer
exception,#EXCEPTION_MESSAGE#,org.sharpe.sample.StencilHandler,exceptionRenderer
It is easy seeing how these might be a pair of "simple" database tables with primary and foreign keys.
Yet, we would like it if we could keep all of this information in a single file. So, we will "create" a CSV with "sections" or a sectioned comma separated values (SCSV) file, using beginning and ending markers like XML elements and the Pascal language.
begin,views
viewId, stencil
landing,/WEB-INF/model/xstencil.xhtml
exception,/WEB-INF/model/exception.xhtml
end,views
begin,placeholders
?We can even implement comments on all lines prefixed with a "single" question mark
viewId, placeholderId, class, method
landing,#PROJECT#,org.sharpe.sample.StencilHandler,projectRenderer
landing,#MODULE#,org.sharpe.sample.StencilHandler,moduleRendererlanding,#CREATE_DATE#,org.sharpe.sample.StencilHandler,createDateRenderer
landing,#HIBERNATE_MESSAGE#,org.sharpe.sample.StencilHandler,hibernateMessageRenderer
landing,#JAXWS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXWSMessageRenderer
landing,#JAXRS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXRSMessageRenderer
landing,#JAXWS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXWSMessageRenderer
landing,#JAXRS_MESSAGE#,org.sharpe.sample.StencilHandler,JAXRSMessageRenderer
exception,#EXCEPTION_MESSAGE#,org.sharpe.sample.StencilHandler,exceptionRenderer
end.placeholders
This structure in our "special" control file will provide a means for representing all of the interactions that are seen on our view storyboard which is built using client-side technologies. It can be seen as a "meta" programming language for our controller, sitting atop the behavior of controller whose "near" cousin is a command shell or high-level language interpreter.
Providing a "clearer" view of our controller system and how it works, the xstencil.xhtml file is below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CABOOSE Standard Stencil</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body bgcolor="F1F8FF">
<!--
I chose that my tile replacement identifiers would
follow the pattern #ALL_CAPS_JAVA_IDENTIFIER#. This
is only a convention and not strictly enforced by the
cab. Obviously, the string used should not collide with
any other one that might be found in a markup document.
-->
<table width="640px" cellspacing="10px" cellpadding="20px">
<tr><td align="center"> </td><td align="left" colspan="2">CABOOSE Standard Stencil</td></tr>
<tr><td align="left">Project: #PROJECT#</td><td align="left">Page Handler: #MODULE#</td><td align="left">Create Date: #CREATE_DATE#</td></tr>
</table>
</body>
</html>
Basically, our controller reads in the entire markup file associated with the "requested" application view. Then, it uses simple programmatic repetition and replaces each placeholder, such as #PROJECT#, #MODULE#, and "CREATE_DATE# with the string produced by their associated class and method in the "directory.scsv" file. This creates the response for the client. The string which the class and method render might be "simple and flat", or it might be a string that describes client-side markup or another technology.
These are our next steps after "just" returning an HTML file.
Here it Be - The File Reads
Team. The MS Windows-based *.zip archive is available that contains the first three steps in this multilingual project which will produce a kernel for a "general-purpose" controller using an incremental parallel build approach. The next step is rather trivial. It simply requires changing the filename of the file which is read and whose contents are returned by the programming scripts. It will likely take more time updating the comments than it will take making this single modification in each source code file.
Yet, we are planning on delivering this next step in three calendar days, based upon other teaching and development responsibilities.
Remember the scripts provided require the proper software environments before they can properly run. These are available on-line for the fourteen languages used in this development project: C, C#, C++, Clojure, Go, Groovy, JAVA, Node JS, PERL, PHP, Python, Ruby, Rust, and TypeScript.
Yet, we are planning on delivering this next step in three calendar days, based upon other teaching and development responsibilities.
Remember the scripts provided require the proper software environments before they can properly run. These are available on-line for the fourteen languages used in this development project: C, C#, C++, Clojure, Go, Groovy, JAVA, Node JS, PERL, PHP, Python, Ruby, Rust, and TypeScript.
Subscribe to:
Posts (Atom)