KEMBAR78
Crafting ColdFusion Applications like an Architect | PDF
Crafting ColdFusion
Applications Like An Architect
Who am I
• Shirak Avakian
• Enterprise Solution
Architect
• QBI LLC
• I code too
• shirakavakian@gmail.com
• @shirakavakian
Subjects to Cover
• Questions to answer
• Software architect vs building architect
• Software architect vs code
Questions to Answer
• How do I start a project?
• How do I find resources?
• How do I collect business
requirements?
• How to prepare my demo for
upper management.?
Read Initial
specification Visualize
Know your
environment
Meet with
users ( not
managers )
Write down
any manual
process
Draft your
solutions
Timeline/budget
Define/Find
resources Craft your first
demo
Questions to Answer
• How to design my business entities?
• Normalize Backend (database) SQL/No SQL
• Do not overwhelm your OOP
• Generate Table Objects / DAO
• Do I need services/API?
• Yes if you want to serve somewhere else
• Yes if you want to make your application
loosely coupled
• No for else
• Do I need a framework?
• Yes (.)
• No if you want to demo proof of concepts
• No if you want to embarrass yourself
• How to make my code cleaner?
• Follow one coding standers and be consistent
• Write comments
• Clean up your code
Understanding Software Architect
Software Architect
Software Architect
Software architecture refers to the high level structures of a software system, the discipline of
creating such structures, and the documentation of these structures.
Facts
• Software architecture is about making fundamental structural choices which are costly to change once
implemented.
• Software architecture is all about structures not technology
• Software architecture must have long term vision
• Business requirement is a key factor to start software architect
• Communication in software architect play a big role on final outcome
• Software architect should represent your system without compromises.
• Abstraction (reducing the details)
Software Architect vs Building Architect
Software Architect vs Building Architect
Building Architecture:
Is both the process and the product of planning, designing,
and constructing buildings and other physical structures.
Software Architecture:
Is both the process and the product of planning, designing,
and coding softwares and other physical/digital requirements.
Software Architect vs Building Architect
Building room floor plan Application servers diagram
Let us convert the room to ColdFusion code
Software Architect vs Building Architect
See Architect 01 source code
• Ask the component!
If it make sense then it belongs to
it
• Example: HasChair() method
makes total sense when you ask
the Bedroom1.cfc
• Can you ask Bedroom1 HasCar()?
NO
How do I know which method
belong to which component?
Software Architect vs Building Architect
•Bedrom1
•AC
Structure
•KingBed
•TV
•Chair
Furniture •getACType
•getChairColor()
•hasChair()
•hasTV()
•hasBed()
•hasFurniture()
Operations
Business functions/objectsServices
Packages
Building
ServiceFactory
See Architect 02 source code
Software Architect vs Code
Software Architect vs Code
View 1
Service 1
Repository 1
View 2
Service 2
Repository 2
• Multi layer design
Software Architect vs Code
1. Repository/Database
2. OOP (Object Oriented Programing)
3. SOA (Service Oriented Architect)
4. UI
Software Architect vs Code
Database normalization, or
simply normalization, is the process of
organizing the columns (attributes) and
tables (relations) of a
relational database to minimize
data redundancy.(Wikipedia)
1- Database/Repository 1 of 2
Software Architect vs Code
1- Normalize your database
2- Create separate SQL authentication
3- Create schemas
4- Create user defined type
5- Use Store procedures & views
6- Prefix store procedures with usp
7- Don’t use plural form for table name
8- Always create diagrams
9- Use constrains & foreign key’s
10- Use SQL Identity Increment
11- Define your primary keys
12- Always have common fields (columns)
Database Best Practices
1- Database/Repository 2 of 2
Software Architect vs Code
2- OOP (Object Oriented Programing) 1 of 2
Inheritance is a mechanism in which
one object acquires all the properties
and behaviors of parent object. The idea
behind inheritance is that you can
create new classes that are built upon
existing classes.
(www.javatpoint.com/inheritance-in-java)
Software Architect vs Code
Business Entities (objects,valueobjects,beans) is predefined objects
represent specific data container for given operation.
2- OOP (Object Oriented Programing) 2 of 2
Software Architect vs Code
3- SOA (Service Oriented Architect) 1 of 5
• CSOA ( Classic Services Oriented Architect )
• SFOA ( Service Factory Oriented Architect )
• POA (Package Oriented Architect )
A service-oriented architecture (SOA) is an
architectural pattern in computer software design in
which application components provide services to
other components via a communications protocol,
typically over a network. The principles of service-
orientation are independent of any vendor, product or
technology.
(https://en.wikipedia.org/wiki/Service-oriented_architecture)
Advantages Disadvantages
1 Service Reusability Increased Overhead
2 Maintainability
Complex Service
Management
3 Reliability High Investment Cost
4 Location Independence
5 Improved Software Quality
6 Platform Independence
7 Increased Productivity
Software Architect vs Code
SOA (Service Oriented Architect) 2 of 5
UI-Model
• ParticipantService
• listParticipants()
ParticipantService
• ParticipantDAL
• listParticipant()
ParticipantDAL • Database
See Architect 03 source code
Classic Service Oriented Architect
Software Architect vs Code
SOA (Service Oriented Architect) 3 of 5
Service Factory Oriented Architect
See Architect 04 source code
Service Factory
UI-Model
ParticipantService
OtherDALParticipantDAL
Validation
LectureService
LectureDAL
Software Architect vs Code
SOA (Service Oriented Architect) 4 of 5
Package Oriented Architect
See Architect 05 source code
UI
Container
API
• Contact Gateway
• Auth Gateway
Implementations
• Base Entity
• Error
• Common Entities
Business Entities
Contact
Service
• Contact DAL
• Person DAO
• Address DAO
• Translator
Login
Service
• Auth DAL
• Identity
• Login
• Translator
Role
Service
• Auth DAL
• Role
• Translator
Software Architect vs Code
SOA (Service Oriented Architect) 5 of 5
Package Oriented Architect
See Architect 05 source code
UI
Container
API
UI – User Interface
Software Architect vs Code
4 – UI User Interface 1 of 2
• Complete Isolation
• Loosely coupled
• Pluggable
• Modular
Things to consider UI
CFML
jQuery
AngularJS
Services
CFC
3rd Party
API
Repository
SQL
File
System
Software Architect vs Code
4 – UI User Interface 2 of 2
See Architect 06 source code
an application framework consists of a software framework used by software developers to implement
the standard structure of an application. (Wikipedia)
Why a Framework?
• Keep your team focus on business layer
• Everyone in your team will follow same structure
• Already tested
• Save time and money
• Easy to train new hire
• Separation of concern
ColdFusion Frameworks
• Coldbox
• Framework One
• CFWheels
• Fusebox
Application Server Architect
Application Server Architect
Application Architect 1
http://myapp/index.cfm/Participant
• URL request to render the view through the handler
• Handler request the data from the model
• Model create service instance
• Model makes a call to the service
• Handler gets the data from the model
• Handler generates the view model (RC)
• Handler render the page (View)
UI & Service on same server
Application server Architect
Application Architect 2
http://myapp/index.cfm/Participant
• URL request to render the view through the handler
• Handler request the data from the model
• Model create service instance
• Model makes a call to the REST service
• Handler gets the data from the model
• Handler generates the view model (RC)
• Handler render the page (View)
Different servers
Server 1 Server 2
Thank You
Source Code
https://github.com/cfclick/CFSummit2016
Don’t leave hold of your common sense.
Think about what you’re doing and how
the technology can enhance it.
Don’t think about technology first.
(Esther Dyson)
Questions?

Crafting ColdFusion Applications like an Architect

  • 1.
  • 2.
    Who am I •Shirak Avakian • Enterprise Solution Architect • QBI LLC • I code too • shirakavakian@gmail.com • @shirakavakian
  • 3.
    Subjects to Cover •Questions to answer • Software architect vs building architect • Software architect vs code
  • 4.
    Questions to Answer •How do I start a project? • How do I find resources? • How do I collect business requirements? • How to prepare my demo for upper management.? Read Initial specification Visualize Know your environment Meet with users ( not managers ) Write down any manual process Draft your solutions Timeline/budget Define/Find resources Craft your first demo
  • 5.
    Questions to Answer •How to design my business entities? • Normalize Backend (database) SQL/No SQL • Do not overwhelm your OOP • Generate Table Objects / DAO • Do I need services/API? • Yes if you want to serve somewhere else • Yes if you want to make your application loosely coupled • No for else • Do I need a framework? • Yes (.) • No if you want to demo proof of concepts • No if you want to embarrass yourself • How to make my code cleaner? • Follow one coding standers and be consistent • Write comments • Clean up your code
  • 6.
  • 7.
  • 8.
    Software Architect Software architecturerefers to the high level structures of a software system, the discipline of creating such structures, and the documentation of these structures. Facts • Software architecture is about making fundamental structural choices which are costly to change once implemented. • Software architecture is all about structures not technology • Software architecture must have long term vision • Business requirement is a key factor to start software architect • Communication in software architect play a big role on final outcome • Software architect should represent your system without compromises. • Abstraction (reducing the details)
  • 9.
    Software Architect vsBuilding Architect
  • 10.
    Software Architect vsBuilding Architect Building Architecture: Is both the process and the product of planning, designing, and constructing buildings and other physical structures. Software Architecture: Is both the process and the product of planning, designing, and coding softwares and other physical/digital requirements.
  • 11.
    Software Architect vsBuilding Architect Building room floor plan Application servers diagram
  • 12.
    Let us convertthe room to ColdFusion code
  • 13.
    Software Architect vsBuilding Architect See Architect 01 source code • Ask the component! If it make sense then it belongs to it • Example: HasChair() method makes total sense when you ask the Bedroom1.cfc • Can you ask Bedroom1 HasCar()? NO How do I know which method belong to which component?
  • 14.
    Software Architect vsBuilding Architect •Bedrom1 •AC Structure •KingBed •TV •Chair Furniture •getACType •getChairColor() •hasChair() •hasTV() •hasBed() •hasFurniture() Operations Business functions/objectsServices Packages Building ServiceFactory See Architect 02 source code
  • 15.
  • 16.
    Software Architect vsCode View 1 Service 1 Repository 1 View 2 Service 2 Repository 2 • Multi layer design
  • 17.
    Software Architect vsCode 1. Repository/Database 2. OOP (Object Oriented Programing) 3. SOA (Service Oriented Architect) 4. UI
  • 18.
    Software Architect vsCode Database normalization, or simply normalization, is the process of organizing the columns (attributes) and tables (relations) of a relational database to minimize data redundancy.(Wikipedia) 1- Database/Repository 1 of 2
  • 19.
    Software Architect vsCode 1- Normalize your database 2- Create separate SQL authentication 3- Create schemas 4- Create user defined type 5- Use Store procedures & views 6- Prefix store procedures with usp 7- Don’t use plural form for table name 8- Always create diagrams 9- Use constrains & foreign key’s 10- Use SQL Identity Increment 11- Define your primary keys 12- Always have common fields (columns) Database Best Practices 1- Database/Repository 2 of 2
  • 20.
    Software Architect vsCode 2- OOP (Object Oriented Programing) 1 of 2 Inheritance is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance is that you can create new classes that are built upon existing classes. (www.javatpoint.com/inheritance-in-java)
  • 21.
    Software Architect vsCode Business Entities (objects,valueobjects,beans) is predefined objects represent specific data container for given operation. 2- OOP (Object Oriented Programing) 2 of 2
  • 22.
    Software Architect vsCode 3- SOA (Service Oriented Architect) 1 of 5 • CSOA ( Classic Services Oriented Architect ) • SFOA ( Service Factory Oriented Architect ) • POA (Package Oriented Architect ) A service-oriented architecture (SOA) is an architectural pattern in computer software design in which application components provide services to other components via a communications protocol, typically over a network. The principles of service- orientation are independent of any vendor, product or technology. (https://en.wikipedia.org/wiki/Service-oriented_architecture) Advantages Disadvantages 1 Service Reusability Increased Overhead 2 Maintainability Complex Service Management 3 Reliability High Investment Cost 4 Location Independence 5 Improved Software Quality 6 Platform Independence 7 Increased Productivity
  • 23.
    Software Architect vsCode SOA (Service Oriented Architect) 2 of 5 UI-Model • ParticipantService • listParticipants() ParticipantService • ParticipantDAL • listParticipant() ParticipantDAL • Database See Architect 03 source code Classic Service Oriented Architect
  • 24.
    Software Architect vsCode SOA (Service Oriented Architect) 3 of 5 Service Factory Oriented Architect See Architect 04 source code Service Factory UI-Model ParticipantService OtherDALParticipantDAL Validation LectureService LectureDAL
  • 25.
    Software Architect vsCode SOA (Service Oriented Architect) 4 of 5 Package Oriented Architect See Architect 05 source code UI Container API • Contact Gateway • Auth Gateway Implementations • Base Entity • Error • Common Entities Business Entities Contact Service • Contact DAL • Person DAO • Address DAO • Translator Login Service • Auth DAL • Identity • Login • Translator Role Service • Auth DAL • Role • Translator
  • 26.
    Software Architect vsCode SOA (Service Oriented Architect) 5 of 5 Package Oriented Architect See Architect 05 source code UI Container API
  • 27.
    UI – UserInterface
  • 28.
    Software Architect vsCode 4 – UI User Interface 1 of 2 • Complete Isolation • Loosely coupled • Pluggable • Modular Things to consider UI CFML jQuery AngularJS Services CFC 3rd Party API Repository SQL File System
  • 29.
    Software Architect vsCode 4 – UI User Interface 2 of 2 See Architect 06 source code an application framework consists of a software framework used by software developers to implement the standard structure of an application. (Wikipedia) Why a Framework? • Keep your team focus on business layer • Everyone in your team will follow same structure • Already tested • Save time and money • Easy to train new hire • Separation of concern ColdFusion Frameworks • Coldbox • Framework One • CFWheels • Fusebox
  • 30.
  • 31.
    Application Server Architect ApplicationArchitect 1 http://myapp/index.cfm/Participant • URL request to render the view through the handler • Handler request the data from the model • Model create service instance • Model makes a call to the service • Handler gets the data from the model • Handler generates the view model (RC) • Handler render the page (View) UI & Service on same server
  • 32.
    Application server Architect ApplicationArchitect 2 http://myapp/index.cfm/Participant • URL request to render the view through the handler • Handler request the data from the model • Model create service instance • Model makes a call to the REST service • Handler gets the data from the model • Handler generates the view model (RC) • Handler render the page (View) Different servers Server 1 Server 2
  • 33.
    Thank You Source Code https://github.com/cfclick/CFSummit2016 Don’tleave hold of your common sense. Think about what you’re doing and how the technology can enhance it. Don’t think about technology first. (Esther Dyson) Questions?