Wednesday, November 23, 2016

Java 6 vs Java 7


Java 6 was released in 2006 and is still having a good innings in some software projects around the world, even though Oracle stopped public updates in February 2013. New versions of Java (7 and 8) have emerged since then and that makes it an even more desirable platform to develop software with. 


above image is from the website: https://plumbr.eu/blog/java/java-version-and-vendor-data-analyzed-2016-edition

This article looks at the major additions that I noticed that came with Java 7, which is by the way also not updated publicly anymore since April 2015. I will comment on the changes that Java 8 brought in March 2014 in my next post.

Java is very good in being downward compatible to its older versions. It is very likely that you did not notice much change if you stuck to a more general usage of the language. 

  

above: A different look at the Java SE changes over the years from Tim Ellison: From the Slideshare presentation What's new in IBM Java 8 SE

Remembering Java 6

Let's remember, Java 6 brought two almost revolutionary new ways into the coding paradigm, it firstly allowed for the selection and invocation of a java compiler programmatically! This neat little trick opened up the door to allow us to use new and very creative ways of extending and integrating code into our applications. The second one was the "new kid around the blog" called "Support for pluggable annotations". These two additions allowed frameworks such as Spring and Hibernate to continue to flourish and do so even more powerfully, which largely impacted on the way we write our Java applications today.

Java 7 additions

Java 7 had also a fair share of its own revolutionary additions. First of all, the Java Virtual Machine started to support dynamic languages. This made the integration of languages such as Ruby, Scala, JavaScript, and many more possible.

On the programming front, changes that I welcomed, were, for example, allowing underscores in numeric literals (I use it to make a number with many digits more readable), catching multiple exception types and rethrowing exceptions with improved type checking allowed me to remove unwieldiness in my code, the diamond operator <> saved me from unnecessarily duplicating information in my code when I wanted to use generic instance creation, and finally try-with-resources made my code cleaner and stopped me from losing important exception information in some cases.

The new file I/O library added support for multiple file systems, file metadata, and symbolic links - not that I need this functionality too often. Having said this, the Tiniest Module Container uses local file access and so I might update the code to use this new library.

There were also additions and optimizations in Java2D, several encryption methods were added/deprecated, and Unicode was updated to 6.0, along with a number of other internationalization enhancements.

Java 7 continues being one of the major forces in the software development industry and the latest Java version updates together with the rise of Android have made Java the number one software development language at this moment. 


above image is from the LinkedIn post by Sony George: Most popular programming languages today


Sunday, November 6, 2016

Tiniest Module Container (Serialization)

This post builds on previous posts:
Today we have a look at a Java concept that we will make extensive use of during the development of this project:


Serialization in Java

Serialization is a built-in Java concept that allows us to save (persist) the state of a Java object (instance) to a Stream. In our example, we save it to the hard drive as a file.



Implementation

The concept is relatively easy to implement, all you have to do is to add
implements java.io.Serializable to your class definition.

Be aware that you need to do this for all of your classes that might end up being persistable properties!

I wrote a utility class that contains the code needed to effectuate the persisting and loading of an instance's state:

The Serializer



/**
 * @author      Michael Appelt 
 * @version     0.1 Initial          
 * @since       0.1  
 * @copyright   2016/2017 Michael Appelt        
 */
package appiappelt.util;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;

import appiappelt.shell.Shell;

public class Serializer {

 /**
  * Persist state to disk
  * @throws IOException 
  */
 public static void persist(Object obj) throws IOException {
  if (obj instanceof Serializable) {
      String className = obj.getClass().getName();
             className = className.replace('.', '_');
      OutputStream file = new FileOutputStream(Shell.getCurrentDir()+File.separatorChar+className+".dat");
      OutputStream buffer = new BufferedOutputStream(file);
      ObjectOutput output = new ObjectOutputStream(buffer);
      output.writeObject(obj); 
      output.close();   
  }
 }
 
 /**
  *  Load persisted state
  * @param  obj - The object wanting its persistent state
  * @return a new object representing the loaded state. do remember to copy properties
  * @throws IOException
  * @throws ClassNotFoundException
  */
 public static Object loadState(Object obj) throws IOException, ClassNotFoundException {
  if (obj instanceof Serializable) {
       String className = obj.getClass().getName();
       className = className.replace('.', '_');
       InputStream file = new FileInputStream(Shell.getCurrentDir()+File.separatorChar+className+".dat");
       InputStream buffer = new BufferedInputStream(file);
       ObjectInput input = new ObjectInputStream (buffer);
       obj = input.readObject();
       input.close();
  } else {
       return null;
  }
  return obj;
 }
}
The File name is composed of the current directory String* (operating System independent I hope), the class name ('.' replaced by '_') and a ".dat" as the file type.

*I want that the state is saved within the directory "where the Shell is running". We will "parameterize" this at a later stage.

The loading of the state is nothing else but reading the state out of the File Stream and assigning it to the receiving object instance.



Application

You can see the usage of the Serializer in the JUnit test method below:


Let's unwrap the code above:

  1. We first instantiate a Shell object and add a "test Module" to it.
  2. Using the Serializer, we serialize the collection (a Hashtable) that contains all Modules belonging to the Shell.
  3. We instantiate a new Shell object, load the state that we persisted in 2. and "enumerate" through the collection of Modules, printing to screen the instance's names.
Shell obj instance and Shell newobj instance are now in an identical state with regards to the Module collection and other serializable properties.



Conclusion

With this post, I demonstrated the concept of Java's object serialization to you. We are now able to persist and load state, which is one of the core concepts needed for our Tiniest Module Container to work. 

Stay put for more ... and yes, you will be able to access/download all of the implementation code once the project is finished.

Monday, October 24, 2016

Tiniest Module Container (Module handling)

I introduced the Tiniest Module Container (TMC) in my previous post: Introduction of Tiniest Module Container

Let me remind you what TMC is: It is an application shell that carries the Modules (a Java construct that has a defined purpose, a defined and unique set of functionality) that make up the total functionality of the application within itself. We use the concept of a customized Class loader and persistent state to achieve this.

Illustration

I extended the illustration from my previous post:

We can say the following about the design:
  • The Shell has a customized Classloader
  • The Shell has a collection of Modules (code and instantiated objects)
  • The Shell has a collection of Interfaces (interface objects that point towards one Module)
  • A Module is installed into a Shell: The customized Classloader reads JAR files containing the Module code, loads these into the application (JVM), stores the code (String) in a Module collection and saves the Shell's persistent state containing the ingested code. The JAR file of the installed Module is deleted.
  • The Shell's persistent state can contain application parameters and many more attributes (operation).
  • A previously installed Module will be instantiated at the Shell's instantiation (start-up / initialization). 
  • One Interface Object is instantiated for each Module, other Modules (application code) evoke functionality of the Module through it. 

Process flows

So far we have discovered two process flows, one for installation, and one for initialization:

Below you will find a draft version of the Instantiation Process Flow. I might employ a slightly different organization/strategy once I start to implement it but for the moment these steps seem reasonable.

Draft Instantiation Process Flow:

Conclusion

I do not want to overwhelm or bore the reader with too much detail. I think that the explanation above describes an aspect of the idea and points into the direction that I want to go with this.

My next post will take a closer look at Java's Serialization Concept

Saturday, October 15, 2016

Introduction of the Tiniest Module Container

Introduction

I have worked many years building Java Applications in all sorts of environments, using different tools and standards . As many of the modern platforms, libraries, services and standards available, OSGI is a very useful construct to plug modules (collection of libraries) together to create a homogenous Java application.  I remember a project I participated in that took place about 4 years ago where I had to integrate web server, database, GUI, printing and other kinds of functionality into one single OSGI container. To be honest, it felt often like being inside somebody else's nightmare. I had to combine compounds of libraries that worked well on its own but clashed with another compound if unified within one OSGI container. I succeeded at the end resolving the hundreds of Class loading errors, sometimes having to rebuild libraries according to my own needs. I am optimistically hopeful though that today this is probably not necessary anymore and assembling modules in the latest OSGI containers is a piece of cake.

I do like slim designs, thin layers, software without weight. There is therefore not much inspiration within me to use the often bulky platforms and standards for my own, private work. My experience is that things get in my way and I can not always implement what I need to do quickly and easily. But the idea of OSGI is a good one and reminds me of a construct I created more than 15 years ago

Tiniest module container

The idea of this container is to be a shell that carries the code that makes it an application. It does this with the use of the concept called "persistent state". New functionality modules are installed within it and the maintenance (updates) of these modules happens automatically, almost seamlessly.

Let's look at a tiny overview diagram:


Java is an absolute gem because it gives a software engineer fine tuned extension possibilities like no other implementation language I know. The key to making this concept work is the ability to implement a customized Class loader for the Shell (application).

Got the idea yet? I will develop this further in one of my next post, which will include a Class Diagram and some Process Flow.

The explanation of the Tiniest Module Container continues here: Tiniest Module Container (Module handling)

Friday, October 14, 2016

Meet Chef Baudi and watch him prepare a "Potage Cultivateur"

This video was recorded by me in Chef Baudi's kitchen. 

Lucas Gordon, an upcoming Rock Star entertaining the Bay Area (San Francisco) came for a visit to learn how to make this dish "Chef Baudi style". This presentation is part of the new and exciting Rock-N-Cook cooking/concert series created by Barbara Wahli and Marco Baudenbacher (Chef Baudi). Watch this space for the recording of the latest concert that took place in May 2016.

Video editing was done by me using Adobe Creative Cloud products, mainly Adobe Premiere Pro.

Friday, September 23, 2016

What is this blog about?

I have decided that limiting my posts to only the Filmmaking and Social Media Marketing domains is not giving justice to my many different activities.

I decided to rename my Blog and will write posts addressing

  • Software Engineering (specifically Java Development)
  • Video Content Production and Video Editing
  • 3D and 2D Computer Animation
  • Social Media Marketing

I hope that you will find posts here that are relevant, interesting and hopefully entertaining too.

Have a great day!
Michael 

Monday, June 20, 2016

Marketing Videos for Schools on Social Media

In this post, I give a few of my thoughts on how to use video to your advantage on Social Media. The information is relevant for Schools or any other brand that wants to tell its story and follow the current trends in digital marketing. 

Click here to see my post on LinkedIn

Friday, June 17, 2016

Scoop of today: Social Media tips & establishing business trust

Today we have a good lineup of sage advice.

  • One important question with regards to your Social Media efforts is how often do I post? When have we overdone it"? I found an article that gets you thinking about that. 
  • Reputation, reputation, it is all about reputation in the business world. You will find 7 tips that you can use for your business below.
  • Twitter has a powerful analysis tool, do you know it? Find more about it below.
  • Somebody took the time to analyse 100 Facebook Adverts. Read what they learned below.

                                                                                                                                                                   











Wednesday, June 15, 2016

Scoop of the day: Video in Social Media Marketing

Another collection of interesting articles I found.

The focus today is on the importance of visual content, specifically video, for your internet presence be it on Social Media or your Website. 

Video shows, explains, engages, creates trust and Video can help you to get these conversions!

Visit me on AppiAppelt Animations and let's get your Social Media Marketing campaign going.


Tuesday, June 14, 2016

Scooped today: Social media morning posts

Three interesting posts I found this morning, with the LinkedIn news surely the biggest news in the Social Media world. 

Live Streaming can greatly enhance the presence of your brand on Social Media but it can also irritate the jahoobies out of your viewership. Balance and exceptional content of impeccable quality is always a good way to go.

Sunday, June 12, 2016

The puzzle of Assembling a film

The team from Condor Films shares their insights with us freely on their very informative blog videothink.info. You will not regret subscribing to their newsletter.

In the blog post I share with you, the team is explaining why the expression "cutting film" is not cutting it anymore. They sketch and illustrate what film editing or assembly is and how much better these terms describe the process.



Preview of the share image

Saturday, June 11, 2016

Hello and welcome to AppiAppelt Animation's blog!


You will find information about filmmaking and social media marketing here. Do not hesitate to subscribe in order to enter the information stream.