Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build a Shopping Cart in 24 Hours with Spring

Phil
July 15, 2014

Build a Shopping Cart in 24 Hours with Spring

Creating a transactional website that is secure, fast, and responsive is a challenge all on its own. Creating one in 24 hours borders madness, however with the resources that Spring brings to the table, this can be accomplished. Casey Doolittle and Phil Dutson were issued the task of creating a charity-benefit website two days before the sale started. By leveraging the flexibility and power that various Spring components bring to the table, this mighty feat was accomplished. During this talk Casey and Phil will discuss the how and why of using Spring 3.2.4, Spring Web MVC, and Spring Security 3.1.4 as their framework of choice to get the project done on time.

Phil

July 15, 2014
Tweet

More Decks by Phil

Other Decks in Technology

Transcript

  1. Introductions: Phil Dutson ▪ Solution Architect for Mobile, UX, and

    Client-side implementation at ICON Health & Fitness ▪ Author of mostly-dry technical books
  2. 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)
  3. 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
  4. The Challenge: Server Agnostic Develop and build using a local

    Tomcat installation, run the app anywhere ▪ IBM WAS ▪ JBoss ▪ Glassfish
  5. The Challenge: Must be able to process orders ▪ Connect

    with an order system (AS400, SAP, etc) ▪ SOAP service for order creation
  6. 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
  7. 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
  8. ▪ Identify the objects ▪ Create a way to manage

    the system ▪ Pick and implement the tools needed for the job Road Map: Plan
  9. Road Map: Identify the Objects Site Flow ▪ Home ▪

    Category ▪ Payment Information ▪ Completion Products ▪ Inventory ▪ Price
  10. 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
  11. 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)
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. ...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)
  18. Thank You! You can stalk us online: +CaseyDoolittle (https://plus.google.com/+CaseyDoolittle) +PhilDutson

    (https://plus.google.com/+PhilDutson) @dutsonpa (https://twitter.com/dutsonpa)