Web Applications and Services : All You Need To Know [Part 3]

Enterprise Computing

 

Computers in business

The hard job in commercial computing is not writing word processors, but to integrate the various business activities – selling, buying, managing, coordinating production.

The key asset in business computing is that data the business has collated over the years which is usually held in some form of data management system.

Business computing therefore has to integrate the front end activities carried out by users of a business application with the data held in the databases.

Changes in the data and requests from the front end must be intepreted through the business logic. [1]

 

The Two Tier model

The Two Tier model also known as the the Client Server model, consists of the following:

Clients
The Internet
Server(s)

This can be visualized like:

Two Tier

 

 

 

 

 

Three Tier Model

The Three Tier model follows on from the Two tier architecture by making a clear separation between the server’s business logic and the data it manipulates and stores.

This model consists of the following tiers:

Presentation (Client) Tier
Application (Logic) Tier
Data Tier

and can be visualized like this:

Three Tier

 

 

 

 

 

 

 

 

 

 

Presentation (Client) Tier 

The presentation tier serves as a point of entrance to the application, it can contain several different views showing the same information in many forms:

- Web pages (html,xml,JavaScript,Java applets)

- Mobile Apps

- Fully blown applications (Java, C++, …)

- … or no views (e.g. a web service client)
Application (Logic) Tier 

Unsurprisingly this runs on the application server(s). Objects, components and modules are used to encapsulate the business logic (business logic can be thought of as the storage, retrieval and processing of data).

Since the business logic is highly likely to evolve the programming approaches must be designed for change, to this end component-based designs with loose coupling and service composition are preferable as these practices lead to more flexible designs which are easier to maintain.[2]

A cheeky aside: The J2EE standards intend to provide business objects that  support the implementation of such business logic within a component based framework.

Data Tier

This tier is responsible for managing the data, and whether any storage, retrieval or other manipulation actions are efficient.

This can be comprised of  Relational databases or NoSQL databases (based on key-value stores like Amazon Dynamo and Berkley DB or based on graphs like Neo4J).

Data Tier specifics are sometimes hidden to the application tier. The JDBC and the Java Persistence API can both be used to this effect.

Legacy Systems

Many companies are stuck with existing software due to it critical to day to day operations for this reason or others the company is heavily invested in that particular implementation and as this software functions as is necessary it rarely gets replaced. For example a lot of business systems still use COBOL.

To integrate legacy software with new systems requires software rappers that can communicate with the new systems.

 

Web Computing

What are the ingredients required to implement a Web application?

- Browsers, supplied by the clients.

- A program that handles HTTP requests according to the protocol specs from one of these client browsers.

This is all well and good but many individuals, universities, companies and opensource communities have done this before and we don’t want to re-invent the wheel badly. [2]

There is tonnes of well tested network stacks as well as web, application, and data servers/frameworks out there.

Demystifying Web and Application Server Language

What are web servers, web servers++ and application servers

Web servers – these simply handle HTTP requests according to the specification laid out in RFC 2616 [3]. Examples include the popular Apache and Nginx as well as IIS and GWS.

Web servers++ – these are web servers which offer a Web server as well as additional goodies, common instances include Apache Tomcat, and Eclipse Jetty which feature JSP and Servlet containers as well as other extras.

Applications servers – these cover all your needs not only do they host and run your applications but can host middleware and function a web servers.

 

Middleware and J2EE

Middleware is a piece of software that sits on top of other sofware and implements reusable functionality [2]. Often middleware exports what is known as an API (Application programming interface) to developers to allow them to utilize the power of the software beneath.

J2EE can be viewed as middleware for developing and deploying business applications, whether these applications be muti-tier, distributed enterprise scale for the web or not.

 

J2EE Application Servers

Common J2EE application servers include:

- Glassfish – this is the application server that was focused on during my studies and was used heavily throughout my lab work and assignment. Glassfish is typically ahead of the others in terms of J2EE compatibility

- Apache TomEE (Apache Tomcat + J2EE)
- Apache Geronimo
- JBoss (now known as WildFly)
- IBM Websphere

J2EE at a Glance

 

At a Glance

 

 

J2EE APIs – Web Container

 

• Servlets, JavaServer Faces, JSP (JSF and JSP uses Servlets)
• Implement Web Pages and interact with other Web Container Components and the EJB Container

• Java Persistence - uses an object/relational mapping approach to bridge the gap between an object-oriented model and a relational database

• Transactions (JTA)

• JMS (Java Messaging Service) useful for sending messages between clients providing loosely coupled, reliable and asynchronous distributed communication
• Web Services
• Context and Dependency Injection
• Expression Language
• Concurrency Utilities
• WebSocket
- JSON handling functionality
- plus all the stuff J2SE supports

Useful acronyms to know:

- XML (eXtensible Markup Language) and XML Schema
- SOAP (Simple Object Access Protocol)
- WSDL (Web Services Description Language)
- UDDI (Universal Description, Discovery, and Integration)
- JAX-RPC (Java API for XML-based RPC)
- SAAJ (SOAP with Attachments API for Java)
- JAXR (Java API for XML Registries)
- JAXP (Java API for XML Processing)

J2EE APIs – EJB Container

The EJB container makes use of a subset of this functionality.

- Java Persistence
- JMS
- Web Services
- Context and Dependency Injection
- Concurrency Utilities
- JSON
- plus what J2SE supports

 

Other Java Enterprise Middleware

Why do such frameworks exist? Features differ between different frameworks, some are unhappy with the performance of a particular framework, or just want to create their own for the crack. Creating your own means the sky is the limit and you have ultimate control, however producing something with the feature set of J2EE from scratch would be a mammoth task. An incomplete list of frameworks in different languages can be found below and at [4].

Spring Framework - A holistic web and application framework

• Web Application Frameworks (built on top Servlets)
• Apache Wicket
• Apache Tapestry
• Apache Struts
• Apache Click

Yesod (Haskell)
Ruby on Rails (Ruby)
Django (Python)
Lift! (Scala)

MVC in J2EE

MVC (Model View Controller) is a common design pattern which is classified as an architectural pattern, these are useful for organizing an application during the development stages and following them can provide your applications with many useful benefits as well as making the code more flexible and maintainable.

Separation of functions
- Model encapsulates the core data and functionality
- View encapsulates the presentation of the data – there can be many views
- Controller accepts input from the user and makes request from the model for the data to produce a new view

MVC in J2EE

MVC can be seen in the structure of the J2EE framework, to demonstrate this we can simply map elements of the J2EE framework to the MVC concepts.

- View => JSP, Java Server Facelets

- Controller => HTTP Servlets, Faces Servlet

- Model => JSF Managed Beans, Enterprise Java Beans, Java Persistence and Data sources.

Conclusion

This post covered the basics of enterprise computing, and discussed multi-tiered models. A Brief overview of the J2EE web application framework was discussed along side other potential options. Finally I reviewed the MVC Design Pattern and how it can be seen in the J2EE model.

 

[1] Distributed Systems Course Notes, http://www.it.uom.gr/teaching/distrubutedSite/dist-sys/dist-sys.html, Ian Wakeman

[2] Web Applications and Services Lecture Slides, University of Sussex, George Parisis.

[3] RFC 2616, www.ietf.org/rfc/rfc2616.txt

[4] A List of Web Application Frameworks, Wikipedia, http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks

Web Applications and Services : All You Need To Know [Part 2]

Basic Concepts of Web Applications and Services

 

What is a Web Application?

Daniel Nations writing for “about.com” describes a web application as an application that is typically run in a web browser and “can be as simple as a message board or a guest sign-in book on a website, or as complex as a word processor or a spreadsheet.”[1]

Web applications typically feature a combinations of both server side and client side scripting. The most common client side script for web applications is the markup language HTML which typically links other assets including images CSS and JavaScript.

Another common feature in web applications is the use of cookies which can provide input to the server programs the data of which is keyed in HTTP requests and then looked up across various data stores. [2]

These server programs are written in languages such as PHP, ruby, ect. and very commonly Java.

 

A Deconstruction of a web application

The following is a break down of the process that is followed when accessing a conventional web application.

1. An IP address is located which corresponds to the DNS name initially provided by the user. This step may be used to implement server load balancing and top optimize content distribution (through companies like Akamai).

2. (Optional) A machine is chosen based on load balancing.

3. The corresponding state to that detailed in the cookies is looked up.

4. The server then conducts the following two tasks in parallel:

1. Execute the primary purpose of the request

2. Execute secondary business applications (e.g. advert brokering, machine learning tasks)

5. The user’s history is saved.

6. Finally the constructed HTML is returned as a response to the user.

 

Common Web applications

Amazon
Facebook
Twitter
Dropbox
Google Search and its many services.

 

The Infrastructure behind Web applications and Services

So there are these things called Data centres, yeah? Thousands of commercial of the shelf computers managed in racks with tiers of network connectivity. These can be used to provide services directly or their power can be harnessed in the form of virtual machines, think vmware or xen.

Data centres lie at the heart of large scale web applications and cloud computing provisions. There is also the concept of cloud management coordinated by systems such as Hadoop.

 

The Web and Databases

The notion of relational databases is common with even the most novice computer scientist. These are typically large tables of multi-field records (often identified through the use of a primary key) which can be indexed by various data structures, relationships (one to one, one to many and many to many ) can be constructed by specifying foreign keys which link to fields in other tables.

MySQL is a popular RDBMS (Relational database management system) which works well for small to medium datasets.

The major problem with MySQL is that once your usage reaches a certain point , you spend a lot of time managing hardware and how many instances you have this is because normally each connection to MySQL requires its own thread on the server. This approach is not feasible at the scale of a company such as YouTube’s operations where running more than tens of thousands of connections is not really viable. [5]

Instead there is a move towards tables of simple key value pair databases, see NoSQL.

So we could be reading and writing state across multiple machines!!

This leads to some key Questions:

If state is stored across hundreds, possibly thousands of machines how can consistency be maintained?

How can the highest levels of availability maintained across such systems?

How can high performance be ensured when reading and writing across multiple machines? [2]

 

In this module we focused on Java 2 Enterprise Edition, Why?

Simply put… write once, run anywhere!

We’re talking about the Java programming language, sometimes referred to as J2SE. Executed using the JRE, (The Java Runtime Environment, this provides the minimum requirements for executing a Java application and is made up of the Java Virtual Machine (JVM) along with core classes and supporting files[4]).

Once there is an implementation of the JVM (Java Virtual machine) for a particular combination of hardware and operating system we’re in business. Just take a look at [3] where they detail the alarming amount of machines that are capable of running Java.

J2EE is a standardisation of the services needed to build complex applications over the web and databases. [2] Once producing applications in J2EE an application server is then used to provide a runtime environment that can interpret the configuration of J2EE applications and provide the necessary services.

Such application servers include, Glassfish, JBoss and WebSphere.

Conclusions

Web Applications are now commonly built on complex distributed platforms.

Understanding such platforms is important and arguably necessary to writing high performance web code.

Frameworks may have distributed features which when integrated help in writing such web applications.

 

[1] http://webtrends.about.com/od/webapplications/a/web_application.htm, about.com, Daniel Nations

[2] Lecture Slides, University of Sussex, George Parisis

[3] Learn About Java Technology, http://www.java.com/en/about/

[4] Java Runtime Environment (JRE), http://searchsoa.techtarget.com/definition/Java-Runtime-Environment

[5] Youtube scales MySQL with Go code, http://www.pcworld.com/article/2020581/, Joab Jackson.

Web Applications and Services : All You Need To Know [Part 1]

Over the next few weeks I will be revising for my Web Applications exam, in order to monitor my progress of revising the material I will blog about the various topics that I need to cover. The exam will take place at Sussex University. Please feel free to make use of the my posts regarding this exam and the topics covered in any way you please. Disclaimer: I am not, neither do I claim to be an expert in any of the fields that will be covered, I welcome, and in fact look forward to, any criticism or comments on the material presented.

The order of the topics covered during the lectures I attended for this course will structure the following posts and serve as guide throughout the material that is needed to be covered for my upcoming exam.

Topics:

Basic Concepts of Web Applications and Services
Enterprise Computing
The Hypertext Transfer Protocol (HTTP)
The Apache Web Server
Remote Procedure Calls
Remote Method Invocation
Web Services
Names and Name Services
Overlay Networks and Distributed Hash Tables
Java Server Faces (JSF)
Enterprise Java Beans (EJBs)
Java Persistence (JPA)
Security
Transactions
Distributed Transactions
Context and Dependency Injection (CDI)
Time in Distributed Systems
Coordination and Agreement

-Mikey..

Semester Two

So guess what guys and girls of the internet!! I totally dominated my first semester at Sussex University (currently on track for a distinction). I have grown even more interested in the field of Natural Language Processing and I’ve met some quirky, interesting and intelligent people. Currently I’m buckling down into my second semester and attempting to keep the grades high. During the next month I’ll be making a start on my thesis, something I’m super excited about this project and will hopefully be blogging the hell out of the gross amounts of reading I will be working my way through to aid its completion.

For now..
Mikey

Free Time

I like to think of myself as a ninja of time; producing time when there is seemingly none. However over the past three months I have realized that my ability to do this has been foiled by the MSc course I’m currently ploughing through at the moment. Deadlines are currently stacked for but will all be over in less than a week. Hopefully I will be able to make a few winter posts soon.

This post was brought to you by procrastination.

-Mikey..

Less is usually more

I believe in minimalism.

Round Two

So, I’m going back to University. This time to try out the Advanced Computer Science Msc at the Universtiy of Sussex. The time freed up from commuting will hopefully translate into a few more posts and more activity in the projects listed in my previous post.

The modules I’ll be taking are as follows:
954G5 Advanced Computer Science Project (The Thesis)
948G5 Topics in Computer Science (winter term)
947G5 Advanced Software Engineering
955G5 Applied Natural Language Processing
817G5 Mathematics and Computational Methods for Complex Systems
G5029 Limits of Computation (summer term)
934G5 Machine Learning
951G5 Pervasive Computing
944G5 Web Applications and Services

Your favourite geek is all ready getting his bookworm on and skimming through the recommended reading.
I’m just so excited! \o/

New and current Projects

This post is more for me personally to keep track of what I’m doing at the moment. But if I know other people can read this and know what I’m ‘apparently’ up to I’m more likely to get it done! So here it goes, a list of my 2013 projects so far.

Programming
Amblr – Tumblr Android App.
Splitter – Android App. (Team – Carl)
Fruit Machine – HTML5 Slot Machine Template.
Beat’em up x 2D Platformer – HTML5 game. (Team)
(see GitHub for all projects minus the beat’em up game).

Writing
Cupid – Maintain a “sentence-a-day” novel
(and post here more!)

Music
Demo Album – write an album’s worth of songs by the end of the year.
(not necessary to record)

Languages
Maintain and increase my vocabulary in German and Polish.
Refresh French phrases before visiting Paris in August

Reading
Thesis background reading.
Masters course background reading.
The Witcher.
Cat’s Cradle

Amblr

People who follow me on Github may have noticed a stub repository created about 5 months ago which seemingly nothing happened to as this was my last activity on Github until this morning. Well, I have actually been messing around with code tutorials and reading up on Android at dev.android.com. I decided (about five months ago) that my first app would be a Tumblr client. A social site that fosters trends within shared interest groups by the means of “reblogging” other users posts. More relevant to this app users of Tumblr can follow the blogs of other users and all the posts of the blogs a user follows are aggregated into an infinite scrolling dashboard.

As a new and avid user of Tumblr I was frustrated with the lack of a nice app which caches a large enough amount of the dashboard offline in order for me to browse my Tumblr dashboard in the train on the way to work on my tablet; where I have little/no internet connectivity (for example). So I decided to implement this functionality and create an android app of my own, this also allows me to exhibit my knowledge I’ve gained on the OAuth protocol as the app will have to handle the consumer role as it retrieves and displays information by communicating with Tumblr’s API.

I’ve been playing around with two Java OAuth libraries, Signpost and Scribe. This morning I committed my progress with the Scribe library.

So prepare for Amblr, the Tumblr viewer/client for Android devices, to be coming soon (subject to my weekends being free).

Upgraded to Anki 2.0

With this post I’m completing my final session in my Anki version 1.2 decks. I have downloaded Anki 2.0 and converted my decks over to the new Collection format. The new Anki application itself is a lot lighter and faster. I think this is partially due to the design change which leaves the background white instead of grey, this could ultimately prove irritating for late night review sessions and I’m going to miss my grey, but there is deffinately a performance increase. Also syncing changes is a lot quicker as the whole deck is not uploaded/downloaded with each sync action rather only changes are pushed and updated to the appropriate collection (deck).

The decks are now shared via the AnkiWeb site. Links can be found for German here and Polish here.