Slide 1

Slide 1 text

© 2013 Spring, by Pivotal Building an eCommerce site using Spring in 24 hours

Slide 2

Slide 2 text

Introductions

Slide 3

Slide 3 text

Introductions: Casey Doolittle ▪ Java Solution Architect for ICON Health & Fitness ▪ Spring enthusiast

Slide 4

Slide 4 text

Introductions: Phil Dutson ▪ Solution Architect for Mobile, UX, and Client-side implementation at ICON Health & Fitness ▪ Author of mostly-dry technical books

Slide 5

Slide 5 text

The Challenge Why would you ever want to build an eCommerce store in 24 hours?

Slide 6

Slide 6 text

To be fair, we have done eCommerce before seriously. a lot.

Slide 7

Slide 7 text

The Challenge: Pure madness ▪ Build a transactional-site in 24 hours ▪ Server Agnostic (run on Tomcat and WAS) ▪ Must be able to process orders ▪ Manageable inventory ▪ Responsive Design (RWD)

Slide 8

Slide 8 text

The Challenge: A transactional-site in 24 hours ▪ Communication is the key ▪ Everyone must ask questions and discuss solutions ▪ Otherwise, failure is your only possible outcome

Slide 9

Slide 9 text

The Challenge: Server Agnostic Develop and build using a local Tomcat installation, run the app anywhere ▪ IBM WAS ▪ JBoss ▪ Glassfish

Slide 10

Slide 10 text

The Challenge: Must be able to process orders ▪ Connect with an order system (AS400, SAP, etc) ▪ SOAP service for order creation

Slide 11

Slide 11 text

The Challenge: Manageable inventory With the store being the online representation of a physical location, there is a set number of items or products available and the list needs to be updated to match sales made at the physical store ▪ Inventory/stock adjustment ▪ Price adjustment

Slide 12

Slide 12 text

The Challenge: Responsive Design (RWD) ▪ No matter the device, a user needs to be able to view products as well as complete a purchase ▪ We used “base” (https://github.com/dutsonpa/base) as our RWD starting template and made slight modifications to match a brochure that was emailed to potential customers ▪ We used a fluid layout that would break into columns to take advantage of available screen space and allow us to to stack information together on a single category page

Slide 13

Slide 13 text

Road Map After getting the requirements, here is our plan to success

Slide 14

Slide 14 text

▪ Identify the objects ▪ Create a way to manage the system ▪ Pick and implement the tools needed for the job Road Map: Plan

Slide 15

Slide 15 text

Road Map: Identify the Objects Site Flow ▪ Home ▪ Category ▪ Payment Information ▪ Completion Products ▪ Inventory ▪ Price

Slide 16

Slide 16 text

Road Map: Admin Tool ▪ Add and edit products ▪ Add and edit categories ▪ Set product prices ▪ Set product availability ▪ App security - host on a restricted domain ▪ Database access

Slide 17

Slide 17 text

Tools

Slide 18

Slide 18 text

Tools: Spring MVC

Slide 19

Slide 19 text

Tools: Spring used in JSP

Slide 20

Slide 20 text

Tools: Spring Security HTTPS everywhere ▪ Once unsecure, always unsecure You may think that going secure from the beginning is going to slow your site down due to encapsulation of files and TCP SSL negotiation, this would normally be the case, however once you are end-to-end secure you can harness the power of SPDY ( http://www.chromium. org/spdy/spdy-whitepaper) to minimize round-trip time as well as enable header-compression and multi-domain requests ▪ SPDY was donated by Google to the Apache Foundation (https://svn.apache. org/viewvc/httpd/mod_spdy/trunk/) ▪ SPDY is also available for Nginx (http://nginx.org/en/docs/http/ngx_http_spdy_module.html)

Slide 21

Slide 21 text

Tools: Security configuration

Slide 22

Slide 22 text

Tools: Mongo Benefits of NoSQL ▪ Speed ▪ Flexible ▪ Data Cluster Considerations that must be taken with NoSQL ▪ Speed - Indexing is still something you need to do ▪ Flexible - just because you can doesn’t mean you should

Slide 23

Slide 23 text

Tools: Mongo Configuration

Slide 24

Slide 24 text

Tools: Jackson ▪ Partial REST API ▪ Hand off of data from back to front ▪ Easy Integration into the project ▪ Download at https://github.com/FasterXML/jackson ▪ Insert .jar files into lib ▪ Annotate methods

Slide 25

Slide 25 text

Tools: Credit Card Processing Hand off of the CC: ▪ PCI Compliance (https://www.pcisecuritystandards.org/) ▪ Tokenization to protect your customers and yourself when you get hacked ▪ PayPal, Amazon, Google Wallet, other third-party provider

Slide 26

Slide 26 text

You’ve probably worked with this project manager too... Requirement Changes

Slide 27

Slide 27 text

Requirement Changes: Change request during the build Add donations ▪ Not a standard product ▪ Customer Assigned value ▪ Return receipt is a tax document Treat the store like a brick and mortar ▪ Open and close times

Slide 28

Slide 28 text

Requirement Changes: Donations

Slide 29

Slide 29 text

Requirement Changes: Open/Close DelegatingFilterProxy

Slide 30

Slide 30 text

Open/Close Filter

Slide 31

Slide 31 text

The Past and the Futurious Yeah, Phil probably shouldn’t write any more puns

Slide 32

Slide 32 text

The Past…: What we didn’t do We did not do the following: ▪ Test driven design/development ▪ Spring Boot ▪ Spring Data ▪ Maven / Gradle ▪ Ant ▪ Spring Security instead of the Open/Close filter

Slide 33

Slide 33 text

...and the Futurious: What next? We built another eCommerce site: https://shop.ifit.com/ ▪ Built in 8 days (spanning a holiday) from the charity base ▪ Used Handlebars (http://handlebarsjs.com/) for content management ▪ Fleshed out the REST API with robust product, category, and order calls ▪ Added a template engine (we like SiteMesh - https://github.com/sitemesh)

Slide 34

Slide 34 text

Thank You! You can stalk us online: +CaseyDoolittle (https://plus.google.com/+CaseyDoolittle) +PhilDutson (https://plus.google.com/+PhilDutson) @dutsonpa (https://twitter.com/dutsonpa)