Designing Business Rules for Scalable Apps
Key Points
- Jam Spain, an IBM Cloud Developer Advocate, recounts his early experience building a large‑scale online admissions system nearly 14 years ago, which forced him to embed extensive business logic directly into application code.
- He defines **business rules** as the everyday logic programmed into applications, distinct from **business requirements**, which describe the desired outcomes or success criteria of a system.
- Initially, his code scattered decision‑making across many functions and workflows, leading to duplicated logic, “band‑aid” fixes, and difficulty maintaining the system as requirements evolved.
- Centralizing this logic into a dedicated **business‑rules engine** (or separate rule classes/interfaces) provides a cleaner, more maintainable architecture that isolates business logic from core application code.
Sections
Full Transcript
# Designing Business Rules for Scalable Apps **Source:** [https://www.youtube.com/watch?v=O0xcKqnBPx8](https://www.youtube.com/watch?v=O0xcKqnBPx8) **Duration:** 00:14:00 ## Summary - Jam Spain, an IBM Cloud Developer Advocate, recounts his early experience building a large‑scale online admissions system nearly 14 years ago, which forced him to embed extensive business logic directly into application code. - He defines **business rules** as the everyday logic programmed into applications, distinct from **business requirements**, which describe the desired outcomes or success criteria of a system. - Initially, his code scattered decision‑making across many functions and workflows, leading to duplicated logic, “band‑aid” fixes, and difficulty maintaining the system as requirements evolved. - Centralizing this logic into a dedicated **business‑rules engine** (or separate rule classes/interfaces) provides a cleaner, more maintainable architecture that isolates business logic from core application code. ## Sections - [00:00:00](https://www.youtube.com/watch?v=O0xcKqnBPx8&t=0s) **Untitled Section** - ## Full Transcript
hello my name is Jam Spain developer
Advocate with the IBM Cloud as a
technologist everyone has that
opportunity to build that first large
scale application for me that's been
almost 14 years ago the first challenge
that I encountered where I had to do
this task all by myself a single coder
of one was actually an online admissions
application now doing that process which
is Way Way Beyond any hello world I had
to actually have the opportunity to put
in business logic into the application
as I was developing it well there's
actually a term for that and it's my
topic for today business rules so what
exactly are business rules if I had to
simplify this for you let's just say
that it is the
everyday
logic that gets programmed into actual
applications um not to be confused with
business requirements which really
that's the output of what you're
developing the application for we can
call it kind of the success criteria so
the business rules are really the way
you formulate that business logic in and
and it's usually done in many different
circumstances but let me pose a
situation for how it came to be that you
kind of kind of work through now now
when you think about it in your existing
applications or as when I approached
that this is generally how that design
actually occurred I started with
application
code and at some point my immediate goal
was to get me over to the actual data
store of
course now at some point I am building
workflows algorithms as you may call it
um particular patterns that I must
follow what happens when someone signs
up what
happens um when they want to register
for a class you know all these type of
things in my mind I was trying to
picture how do you symbolize those and
how does it work so I'll just take two
arrows here but I wanted to kind of
formulate that there are many many
decisions and functions and methods that
must be programmed to work
clearly all my data is is inside my
database so I'm doing a back and forth
this can actually be a two-way street
here but what I noticed and when I think
about when I first started development I
really attached my logic into these
individual flows so here I may have
other
functions that actually ran different
logic and they were just kind of all
over the place functions here functions
there kind of as I started to approach
them or another business requirement
came up or something I had to do that
had to be a part of this workflow I just
kept piggybacking and banding on to
processes all right and it kept on going
kept on going and naturally when I had
to make changes or update or or
something evolved I had to try to go
back in and band-aid and let's hope that
there weren't two types of similar
operations that had to occur in both of
these workflows I had two or more places
to kind of go here so this is where
exactly where it comes in the context of
where I'm talking to you today is
formulate that into business rules so
you'll have a secondary engine code
classes some type of interface that you
want to kind of code into where now
actually a lot of your data flows in
through here and then flows
out maybe to your database has that
process here and this gives you that one
place where you can start to formulate
things to have one particular area that
data has to flow through um and then
this gets me back to why business rules
are really important so we said it's the
everyday logic and you can naturally
know that that's symbolized by your your
your your syntax that we usually do for
a lot of decision trees so you have your
what I like to call the ifs all right uh
so this would be expressing
logic and we said the ifs so that's the
ifs of the
then
only uh if
else and naturally I have other
conditions when something happens this
should happen and maybe maybe um um only
do this particular piece of logic if and
only if uh so you can tell it gets
really it's kind of your basic
structures but gives you a big formal
way of of kind of working with that now
you may say why as I like to do with any
technology or as a technology anything I
want to implement I have to ask myself
that question why do I actually want to
do this there are obvious benefits that
I want to spend my time in re
architecting the application and as I
started to work through this video
concept here I actually thought about
ways I could improved my original design
if I actually went with this kind of
architecture way back then but let's
talk through those and they're very very
important to cover here uh the first is
efficiency a definitely added point
there because naturally you can always
see there's only one place I have to
make changes all right um and that
really helps uh uh with anything that I
want to kind of assimilate and do I have
one place to make the code changes I
also say for
consistency there're definitely going to
be a plus in that area as well um
naturally now with all these different
workflows you think about the context of
an application for an admissions from
maybe um any type of institution that
has to require an application for ad
missions
is you have many different departments I
have one consistent way to represent my
workflows uh and I may have you know
maybe for the admission criteria I may
have better ways to give to the
scholarship committee to understand how
we make decisions on admission so it
gives you kind of a consistent process
that you can use to really help
formulate uh uh a particular workflows
um there as well and then the last we
have efficiency we're going to be
consistent
the
complexity so not increasing complexity
but we have a way
to uh definitely uh decrease uh uh
complexity because now we have um a easy
way to represent how we can take a part
of business workflow and break it up
into constraints and parts that you know
we can simulate it for how it should
work here and now we have a template
that can actually be used for the next
business pro process and the next
business process and quietly this is
really the foundation of entering into
um actual Automation and we'll get a lot
about that please check out the process
mining video we'll talk about how this
this a lot of these activities really
parlay you into that particular context
here but yeah definitely obvious ways
that you can kind of get direct benefits
out let's go back to the logic here
though we mentioned some of the basic
control structures that works but this
also goes by there's there's even a
discipline for classifying how these
rules apply now they can be
constraints and think of constraints as
things that immediately happen I already
know a condition uh that's there so I
know things that I want to do so we'll
call that of a uh a yes criteria I met
something so I can immediately jump here
um uh so for admissions do you have a
certain G PA yes we can go um there's
you can also do pre and
post conditions the what must happen
when the data comes in and out just to
make sure uh two conditions are set um
uh and things that flow from there um
and then uh there's other types of
inference we'll
say all right scribbled on in there we
at least got it in the word is inference
here and that's really uh uh based upon
two particular cont text here I can also
say whenever I have some facts that I
know that I can make decisions on for
instance um um you may I mentioned like
a particular GPA or certain SAT scores I
can make different factors there and
then we have the things that we can
calculate these type of numerical facts
or conditions
here I'll just do calc um and then those
computational things can actually allow
to me to get to to certain facts um here
as well I remember at one point we were
evaluating the applications I had to
build a workflow that helped with
evaluation if you did this on your if
you inputed this from your scoring your
essay you got this many points for a
number of activities GPA all those
things so I have certain facts that I
can then make decisions over to know
you're in a final group off from there
just theorizing here as well so we've
kind of moved through on how you kind of
start out um and how you should have an
architecture to take proper
implementation of business rules we know
the logic that's applied in different
really different situations that you can
build a lot of the workflows to gain
these obvious benefits just to bring it
on home here let's talk through a couple
of use cases that really I can kind of
see besides this that um can really be
useful uh for you to use now the first I
did mention here I kind of gave that one
away but we said the first was
definitely applications
now I'm not saying that every actual web
application project requires business
rules but we are talking some of the
large scale applications that you want
to build definitely anything that
requires an application you have ways
that you can apply definite criteria to
work and also a lot of these situations
let's say in that situation where we had
the application I was building I also
had to prove how applications were
evaluated so for regulations and in
compliance you also can have a track
record on how you went through and made
a decision you know it wasn't just um if
these were just loose rules like here it
has an opportunity that it could not
have gotten picked up or one particular
piece of code could not have done um the
the particular constraint that we wanted
to apply but since everything rinses
through we have a great opportunity to
show how it was evaluated and show that
kind of check and balance uh here let's
say also for e-commerce
so in Ecom let's think about the uh
opportunity when you do purchases and
returns and throughout the pandemic we
know that we've bought a lot of things
online there been numerous products that
have been ordered we definitely always
want to make sure before we go back and
return has it been the 30 days has it
been the 14 days and most a lot of
applications I've G through and and use
and return products you have to request
the return authorization it's Meed going
to ask you when did you purchase this
and so at that first iteration I have an
opportunity to say it's been uh plus or
minus 30 days or
14 and if I would like to that's a great
opportunity for me to go ahead and send
back a rejection sorry it's been past
that time here but definitely give you a
way to help evaluate different pieces
there um and also uh think about
purchasing there's a great opportunity
to interact with other systems of
inventory moving inventory around we all
know that there's been a lot of
inventory issues uh as of yet that we've
come through and last but not least one
that I love I want you to definitely pay
attention to and I think this is great
in today's many of today's architectures
here and it's um
the all right scribble that out
personalization so lot of these engines
everything is personal to you and I love
it when I actually go to I get to browse
a site I may be able to come come back
so let's say you have the opportunity of
new visitors and
returning so if I'm a new visitor I have
a great opportunity to put you into my
new visitor workflow here are my
featured products that I want you to pay
attention to here are my deals the
specials that I have but let's say I'm a
returning user I'm just coming back to a
website this can be an opportunity to
show me what I've been looking at or to
correlate I actually personally love the
engine where I'm able to say other
people who are looking at this they
bought this maybe you should look at
these options as well because it's all
about diving deep into the
specifications and understanding what's
the option of why should I buy this over
that especially when it comes to uh all
the gadgets uh that I love here so we've
done a lot today we talked about
business rules the logic the rules that
are required the obvious benefits that
you can use to really implement this
type of architecture and some use cases
that you can kind of immediately jump
out to you've always wanted to do this
but this is a formal sturdy way of
actually implementing this type of uh
logic in your application if you have
any questions please drop us a line
below and if you want to see more videos
like this in the future please like And
subscribe