Building Commercial Applications with Oracle Applications Express by Scott Spendolini


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Building Commercial Applications with Oracle Applications Express by Scott Spendolini

  1. 1. Developing Commercial APEX Applications Doug Gault & Scott Spendolini Enkitec 1 WELCOME 2 Doug Gault ! ! Using Oracle since 1988 ! Versions 5.1b, 6, 7, 8, 9, 10, 11 ! Focused on Web Technologies ! OWA, ‘PSP’, Web DB, HTML-DB, APEX ! Hotsos Product Development Director ! Co-Founded Sumneva ! Now part of Enkitec ! APEX PRACTICE DIRECTOR ! Focused on Providing World Class APEX Products, Education and Services 3 ! ! @sspendol ! Ex-Oracle Employee of 10 years ! Senior Product Manager for Oracle APEX from 2002 through 2005 ! Founded Sumner Technologies in October 2005 ! Co-Founded Sumneva in January 2010 ! Joined Enkitec in June 2012 ! Oracle Ace Director ! Co-Author, Pro Oracle Application Express ! Author, Secure APEX Development Best Practices ! “Scott” on OTN Forums Scott Spendolini 4
  2. 2. About Enkitec ! Oracle Platinum Partner ! Established in 2004 ! Headquartered in Dallas, TX ! Locations throughout the US & EMEA ! Specialties include ! Exadata Implementations ! Development Services ! PL/SQL / Java / APEX ! DBA/Data Warehouse/RAC ! Business Intelligence 5 Agenda ! Overview ! Design ! Infrastructure ! Testing ! Deployment ! Summary 6 OVERVIEW 7 Disclaimer ! Almost 100% of the content in this session are applicable to any type of APEX project - commercial software or internal 8
  3. 3. Passion for APEX ! Combined 25 years of APEX experience ! Wanted to produce a product with APEX ! Knew that a subject matter expert was needed to succeed ! A tool for APEX developers solved this problem 9 eSERT Origins 10 ! Given the declarative nature of APEX, many security vulnerabilities could be exposed by inspecting the metadata ! Why not build an APEX application to evaluate the security of other APEX applications? Benefits ! Can adopt the APEX footprint ! No additional software or hardware ! Same database and operating system versions ! Tight integration with APEX ! Ease of distribution 11 DESIGN 12
  4. 4. Design ! Hands down the most important phase ! Need to spend ample time here and work out problems on paper not in code ! Conceptual and feature design is just as important as visual design ! Version 1 vs Version 2 ! Core Functionality ! Asynchronous Execution & Collections ! APEX_ADMINISTRATOR_ROLE Role 13 User Interface Mockups ! Balsamic mockups is invaluable ! Issues with UI can be flushed out early and quickly ! Easier to get user feedback as you can send as PDF or image versus installing software 14 User Interface ! Keep it simple ! Keep dependencies similar to that of APEX ! You have no control over when APEX will be upgraded ! If it can't be installed easily, it's not worth including ! Test in all target browsers early and often ! IE will add days to project timeline and subtract years from your life if you wait until the end 15 Dealing with IE ! Initially tried to have a single CSS file for all browsers ! Quickly realized that was a bad idea ! Thus, created a specific CSS for IE ! A little extra work on our side to synchronize the two, but ultimately a better approach 16
  5. 5. PL/SQL ! All code of any length goes in a package ! Even a simple RETURN FALSE ! Benefits of this approach ! Centralized ! Easier to patch ! Single SQL script vs. entire APEX application ! Wrappable ! Upgrade from 4.1 -> 4.0 17 Tables & Views ! All tables accessed via views ! Allows for security and manageability ! Easier to patch 18 Page Zero ! Used as much as possible ! However, need to keep an eye on the number of components placed here 19 Shared Components ! Use as much as possible ! All computations and processes referenced package calls 20
  6. 6. Shared Components ! Images, JS and CSS have to be shared components ! Easier to install and manage ! Can't assume file system access ! Helpful to include version in file names ! Prevents browser cache issues after upgrades 21 Supporting Objects ! Decided to have a split installation ! DB objects installed via SQL Plus as SYS ! Images, JS and CSS delivered as Apex supporting objects ! Gotcha: supporting object definitions need to be updated if their corresponding shared component is changed 22 Versions ! Multiple Apex versions presents a challenge ! Initially thought few customers were using Apex 4.0 ! “Your idea, although interesting, is irrelevant” ! “The answer to your question is not in the building” ! Survey proved otherwise ! Ideally this can be mitigated by having common database objects 23 Database Support ! Piggyback on APEX-supported versions ! 10g R2+ ! Exception was Oracle XE 24
  7. 7. INFRASTRUCTURE 25 Infrastructure Choices 26 ! Source Code Control ! Shared Development ! Automated Builds ! Licensing Source Code Control 27 ! We were comfortable with subversion ! Fear of change? Nahhh! ! Didn’t want to manage our own ! Fear of commitment? Nahhh! ! Looked for hosted version control ! Several out there, but one caught our eye ! WWW.CODESPACES.COM CodeSpaces 28 CUSTOM
  8. 8. CodeSpaces ! Custom “Small Team” Plan ! Fewer Users (6) ! Less Storage (1Gb) ! Unlimited Projects ! Unlimited Repositories ! $200 per year ($16 per Month) ! Flexibility was a big selling point. 29 SubVersion Clients ! Versions 30 ! Cornerstone 2 ! Both were ! Simple easy to use interface ! Allows “experts” to do what they need to do ! Friendly to SVN Newbies ! Recommended SubVersion Structure ! TRUNK ! All development happens here ! Sub-directories created for each type of object ! Included objects that were to be loaded into the app as Supporting Object scripts ! Application was exported and checked in as a single object. 31 SubVersion Structure ! Branches ! Reserved for Branches in the source code line ! When you need to change the code based on changing underlying requirements ! We needed a code branch when we worked with both APEX 4.0 & 4.1 32
  9. 9. SubVersion Structure ! Releases ! Only created after building and testing a release ! Takes a snapshot of all source that was released ! Would allow us to ! Recreate the release if necessary ! Create a Branch / Create a Patch 33 Shared Development ! We faced a number of challenges ! Needed a platform we could share and use to develop collaboratively ! Disparate Locations (Texas & Virginia) ! No hosting capability of our own ! Small company, so cost was important ! Traditional APEX Hosting companies weren’t a good fit ! No access to Internal workspace ! No access to SYS/SYSTEM users 34 Shared Development ! Amazon Web Services ! Inexpensive ! Easy to stand up ! AMI’s already existed with OEL and Oracle Database ! Full control of the machine ! DB Version ! APEX Version ! All the right access ! Safe from ourselves ! Available from everywhere ! Create our own AMI’s 35 Shared Development ! Database Version Choice ! Needed to make sure what we developed would work across all versions ! Looked at XE ! Found issues on 10XE with some of the SQL syntax that we were using ! Settled on Oracle 10g SE as base development platform ! Lowest common denominator ! Lowest cost to the customer ! What we wrote here would work on Enterprise Edition ! Fairly confident that things would port seamlessly to 11+ 36
  10. 10. Automated Builds ! Needed a way to create a “Release” of the software ! Install testing, functional testing, actual release ! Manual method would get very tedious very quickly ! Knew from previous experience that Apache ANT could automate this type of thing 37 Automated Builds ! Created an ANT build.xml script allowing us to ! Dynamically create the working directory ! Check the most recent version of code out of SVN ! Replace @VERSION@ variables in code with a dynamic versions number passed on the command line ! Choose to WRAP Oracle PL/SQL code ! (or not for dev builds) ! Zip the files into a “Release” ! Clean up the working directory 38 Automated Builds ! Final Build Script had 3 main targets ! RELEASE ! Create a final wrapped and zipped release ! NOWRAP ! Create a full release with unwrapped PL/SQL ! CLONE ! Create a Development version that doesn’t replace the @VERSION@ Tags 39 ant <Target> -D sv_version=020100 Product Licensing ! Licensing requirements were unique ! We understood that product licensing can almost always be subverted. It’s there to keep honest people honest. ! Multiple license types ! SITE ! WORKSPACE ! APPLICATION ! Loads of licensing software out there, but nothing that would really work for APEX ! Ended up having to rolling our own in PL/SQL 40
  11. 11. Product Licensing ! Licensing consists of a Customer Key and a License Key ! Customer Key - Hashes information about the server, GUID of the product and other info based on the license type ! License Key - Hashes information that matches the Customer Key as well as Expiration Date and Licensed Company 41 Product Licensing ! Two sets of code ! Application Side ! Creates and encode Customer Key ! Receives, interprets and validates License Key ! Product Owner Side ! Receives and validates Customer Key ! Matches Customer Key to a valid license in our back end system ! Created and encodes License Key, saves it and presents to user 42 Application Side 43 Product Owner Side 44
  12. 12. Product Licensing Benefits ! Allows us to ! scale product use to the need of the end user ! quickly create “Trial” keys that expire after a given amount of time ! limit the use of the product to a specific licensed server regardless of the level of license purchased 45 TESTING 46 Product Testing ! Testing is hard and no one likes to do it ! It covers way more than you might think ! Functional Testing ! Installation Testing ! Upgrade Testing ! Platform Testing ! Do everything you can to make it ! Easy ! Repeatable ! Full Coverage 47 Product Testing ! We chose to use Virtual Machines as our testing platform ! Self Contained “Sandbox” ! Easy to copy a fully set up system ! Easy access to multiple platforms (OS, DB, etc) ! Snapshots ! Makes rollbacks as easy as a button click ! Snapshots of successful installs/upgrades provide the basis for the next generation ! Allows you to setup and test “edge-cases” and keep those around for future tests. 48
  13. 13. Product Testing ! Identified and mitigated several potential problems by having the wide variety of platforms available. ! Issue with install script on Windows based SQL*PLUS ! Issue with 10g and positional parameters in a function when used in a SQL Query ! Lack of support for certain functionality in Oracle XE 49 DEPLOYMENT 50 Deployment ! Decided early on to mirror the APEX install & upgrade scheme ! Allows users to upgrade SAFELY in place ! Allows rollback in the odd case of a failed installation ! Multi Part Install ! Database Schemas and Objects ! SV_SERT_XXXXXX ! SV_SERT_APEX ! SV_SERT_APEX_ALL ! APEX Application ! Application per Workspace ! Application Cross Workspace 51 Deployment ! Database Schemas and Objects ! Modeled on the APEX install Scripts ! SQL Script run as SYS ! Checks pre-requisites ! Creates users ! Creates Objects ! Allows DBA’s to choose underlying tablespace(s) and features/grants to install ! Future versions will ! Migrate data from previous working schema to new working schema 52
  14. 14. Deployment ! APEX Application ! Per Workspace ! Associate the SV_SERT_APEX schema as a Parse As Schema for a workspace ! Install the eSERT APEX Application in the workspace where the Apps to be evaluated are ! Cross Workspace (4.1+ only) ! Requires APEX_ADMINISTRATOR_ROLE to be granted to parse as schema ! Associate the SV_SERT_APEX_ALL schema as a Parse As Schema for a workspace ! Install the eSERT APEX Application in the workspace ! Ability to evaluate all applications across all workspaces 53 Deployment ! Used Supporting Objects quite heavily for images, JavaScripts, CSS ! Didn’t want customers to have to manually copy these items to their web server ! Couldn’t adequately script this as everyone’s install bay be different ! However it was a bit of a challenge ! No “Relationship” between shared components and supporting objects ! Had to keep deleting & Re-creating them 54 SUMMARY 55 Summary 56 ! Developing for APEX is not too unique - but there are a number of unique benefits ! Shorter development cycles ! Ability to use built-in components to save time ! Charts, IRs, User Interface ! Code is easy to write; difficult to maintain ! Thus, less is more ! “The answer to your question is not in the building” ! Customer feedback is critical
  15. 15. Download ! This and all other Enkitec presentations can be downloaded for free from: 57 58