Friday, May 25, 2007

UML rules!

Currently I'm updating the white paper Business Rules in ADF BC. Doing so it occurred to me that there are still many questions to answer what to do when you want to record business rules in UML. With this posting I will share some of my idea's. JDeveloper 10.1.3 will be my tool and ADF BC4J the targeted persistence layer, but I expect the idea's to more generic and also applicable to EJB 3.0 and POJO's for that matter.

In "the old days" when we were young and still using the function hieararchy diagrammer, business rules were either an intrinsic part of the entity relationship diagram or recorded in function descriptions. As this sometimes resulted in the same business rule being recorded more than once (in different functions) and too often in an inconsistent way, we found it to be a neat idea to record them explicitly, that is as functions of their own, and link them to the functions they applied to. This has been a very succesful approach for quite a few years.

At the same time UML arrived as the modeling language for object-oriented analysis and design, and more recently BPMN for business process modeling. As I have never come upon any information system for which there were no business rules whatsoever, you can imagine that it was quite a shock for me to discover that there was no similar thing in place for UML at that time. Of course, a UML class diagram as such allows for expressing more business rules than an entity relationship diagram, but that covers only part of it, doesn't it? As far as the rest is concerned, we were kind of back to square one, meaning that we had to record business rules as part of use cases, for example. The BPMN specification even explicitly excludes business rules from their scope, so what do you do when using BPM?

Some improvements have arrived since the beginning of UML. At some point (not sure since when) constraints have been added (as a stereotype). Also OCL has emerged as a formal language to capture business rules. You can use OCL to record the business rule in a constraint. I don't know about you, but I still have to meet the first person that speaks OCL, let alone the kind of persons we call customers. So in most cases I expect constraints to be recorded using some natural language.

Now let's asume you are using UML to capture functional requirements. Business rules can be found during any stage, for example while doing use case modeling. When starting to create use cases it perfectly makes sense to record rules as part of that. Use cases have some properties that can be used for recording business rules, being pre-conditions and post-conditions. Pre-conditions must be met before the use case can be executed. A typical example would be "the user must be logged on", but could also be something like "the user must be a manager to view detailed employee information".

Post-conditions can be devided in minimal guarantees and success guarantees. Minimal guarantees indicate what must hold true when none of scenarios of the use case have finished successfully. A success guarantee describes a succesfull execution of the use case. Examples of success guarantees are:
  • The employee information has been recorded successfully
  • A change of the employee salary must have been logged
  • When the customer has boarded 15 times or more on a flight, its frequent flyer status must be set to silver elite.
Then there are so-called invariants, being conditions that always should hold true (before, during and after execution of any use case). Examples would be
  • End date must be on or after begin date
  • There cannot be a non-vegetarian dish in a vegetarian dinner.
Your use case template might not have a property called invariants. But hey, it's your use case, so why not add it?

By now you might wonder how to deal with the problem I pointed out at the beginning, being that you captured the same business rule more than once for different use cases. You might also find yourself recording business rules that relate to each other, or even contradict. Don't worry to much about that in the beginning (using the Unified Process that would be while doing Requirements Modeling). Just record the business rules when and where you find them. You only risk a confused customer when you start record business rules as artifacts on their own.

During some next iteration, you detail the use cases. By that time you might have a class model or will start to create one (using the Unified Process that would be during Requirements Analysis). At this point it makes sense to pull business rules out of the use cases and into constraints. Doing so you are able to remove duplications, and inconsistencies.

If your tool supports publishing use cases together with the artifacts linked to that (like classes and constraints ), you might consider to remove the business rules from the use case to prevent duplication and inconsistencies.

Using JDeveloper you normally add constraints to UML class diagrams and link them to the classes they relate to. But you can also include them in use case diagrams and link them to use cases. Finally, you can link related business rules together, which is convenient when you want to decompose business rules.

Having done all this you are not only able to track what rules apply to what classes but also to what use cases. Handy for example for testing purposes.

Finally, you can include the same contraints in (for example) ADF Business Component diagrams, link them to entity objects, classify them or whatever fancy stuff you like to do. Check out the new version of the Business Rules in ADF BC for ideas about classifying business rules when using BC4J. I will let you know when it get's published.

Got to stop here folks. A long and sunny weekend just knoked at my door, and I intend to open ...


jwbroek said...

Hey Jan. Where can we find this whitepaper? :-)

Jan Kettenis said...

The new one is yet to come. After I finished with it, I suppose it will be reviewed. I will let you know where to find, but you can also monitor the JHeadstart blog.

Mashood said...

Hi Jan,

Do you have any experience with Oracle Headstart? We are looking for somone who can impart training.

Please let me know your mail id so that I can write to you in detail about our requirements.



Jan Kettenis said...

I do but that's a long, long time ago (IT-wise spoken) and personally I cannot help you (anymore). It used to be on the Oracle University list of offered trainings.

What I would suggest is that you contact your local Oracle representative and ask if they can help you with this.

Anonymous said...

British tennis ace Andy Murray can expect a massive income injection after joining the same wow po management group that handles the likes wow or of David Beckham and Cristiano Ronaldo.

Simon Fuller's 19 Entertainment, wow geld partnered with CAA Sports, signed world number four LOTR Gold Murray and doubles-playing brother Jamie for representation across all their on and off court activity from LOTR gold March 2009.

"Jamie and I buy Warhammer gold/a> feel we've made big progress in the last couple of years on court," 21-year-old 2008 U.S. Open runner-up Andy said on his Web site.

"It's important that we have the very best team around us to take care of business while buy Warhammer gold we concentrate 100% on our tennis. Warhammer gold So this is a fantastic opportunity for us to work with buy Warhammer gold Simon Fuller, 19 and CAA Sports.

"We now have an Warhammer gold unbeatable combination of representatives buy Warhammer gold with world-class stature and experience, and Warhammer gold we are really excited by what we can achieve buy Warhammer gold together".

Fuller's company, which Warhammer gold is run from London, New York and LA, wow gold has partnered with CAA Sports, and already represents world of warcraft gold the world No. 3 Novak Djokovic.

American Idol creator Fuller buy wow gold commented: "I am very cheap wow gold excited to be working with Andy and Jamie, wow power leveling two of the brightest British wow powerleveling talents in global sports.

"Their determination dofus kamas to succeed has become a kamas dofus trademark in their game and their progress as professional Lord of the Rings Online Gold sportsmen has taken them to the LOTRO Gold top in world tennis.

"19's innovative LOTR Gold partnership with CAA Sports will provide them fly for fun penya with an unparalleled level of flyff penya global support".

Anonymous said...

The All-Star thirddofus kamasdofus kamasbaseman said in an interviewkamas dofusacheter dofuswith ESPN that he used steroids with the Texas Rangers for three years,from 2001-03,in an attemptbuy kamasacheter kamasto justify his status as the game's highest-paid player after signing a 10-year.

Anonymous said...

He said he quitbuy wow goldcheap wow goldafter 2003,hiswow power levelingdofus kamasfirst of three AL MVP seasons,because I've provedbuy ffxi gilLord of the Rings Online goldto myself and to everyone that I don't need any of that.

Anonymous said...

runescape money
runescape gold
runescape money
runescape gold

Anonymous said...

I like a game which needs to use runescape gold, when you do not buy runescape, you must borrowrs gold from friends, or you get runescape money. If you getcheap rs gold, you can continue this game.

Anonymous said...

runescape moneyis your number one spot for all your runescape gold help you may ever need. We have a complete database of tons of quest guides, city guides, runescape gold

Anonymous said...

Once I played stoneage2, I did not know how to get strong, someone told me that you must have stoneage2 Gold. He gave me some stoneage 2 Gold, he said that I could buy stoneage2 money, but I did not have money, then I played it all my spare time. From then on, I got some buy stoneage2 Gold, if I did not continue to play it, I can sell stoneage 2 money to anyone who want.

Once I played flyff, I did not know how to get strong, someone told me that you must have flyff penya. He gave me some flyff money, he said that I could buy flyff penya, but I did not have money, then I played it all my spare time. From then on, I got some flyff gold, if I did not continue to play it, I can sell cheap penya to anyone who want.

Anonymous said...

Do you know the Asda Story gold,in the game you need the
Asda Story money. it can help you increase your level. My friends always asked me how to
buy Asda Story Gold, and I do not know he spend how much money to buy the
Asda Story gold, when I see him in order to play the game and search which the place can buy the
cheap Asda Story gold. I am happy with him.
Do you know the Archlord gold, in the game you need the
Archlord money. it can help you increase your level. My friends always asked me how to
buy Archlord gold, and I do not know he spend how much money to buy the
archlord online Gold, when I see him in order to play the game and search which the place can buy the
cheap Archlord gold. I am happy with him.

World of Warcraft Gold Guides said...

good post :)

Anonymous said...

搬家公司 桃園房屋仲介 桃園房屋買賣 桃園房屋 醫學美容診所 淨膚雷射 雷射溶脂 飛梭雷射 微晶瓷 植髮 團體服 團體服訂做 醫學美容診所 肉毒桿菌 肉毒桿菌瘦臉 醫學美容 整型診所 美國月子中心 月子中心 seo 關鍵字廣告 關鍵字 google關鍵字廣告 關鍵字行銷 網路行銷 通姦 徵信社 外遇 徵信 徵信公司 出軌 清潔公司 搬家公司 搬家公司 台北搬家公司 新竹搬家公司 桃園搬家公司 台北搬家公司 整形 韓風整形 整形 韓風整形 老人癡呆症 情緒管理 訂房網 線上訂房 宜蘭民宿 宜蘭住宿 網路訂房 宜蘭飯店 新娘祕書 清潔公司 植牙 裝潢 室內設計 油漆粉刷 油漆工 油漆工程 洗鞋加盟 洗包包加盟 洗包包 創業加盟店 早餐店加盟 開店創業 創業開店 結婚金飾 鑽石婚戒 通水管 通水管 通馬桶 抽水肥 包通 馬桶不通 通馬桶 通水管 清水溝 沙發 室內設計公司 室內設計 室內裝潢設計 裝潢設計 澳門自由行 香港自由行

Anonymous said...

彌月禮盒 彌月禮 彌月 離婚 法律事務所 債物 律師事務所 律師 寵物醫院 獸醫 獸醫院 寵物住宿 白內障 心絲蟲 腎衰竭 狗皮膚病 動物醫院 獸醫師 創業鞋之澡堂 洗鞋子 洗包包加盟 洗鞋店 加盟 洗鞋 洗包包 洗鞋加盟 酒店式公寓 台北民宿 日租套房 台北日租 apartment 太平山民宿 宜蘭民宿推薦 宜蘭民宿 宜蘭旅遊 宜蘭住宿 Disposable plastic cups Disposable plastic cups Disposable products Plastic Drinking Cups ECO products Biodegradable plastic PLA polylactic acid Biodegradable Plastic Cup Plastic manufacturer 懷孕 坐月子 坐月子食譜 新竹坐月子中心 坐月子中心 坐月子餐 月子餐 月子餐外送 外送月子餐 素食月子餐 飛梭雷射 柔膚雷射 玻尿酸 皮膚科 皮膚科診所 肉毒桿菌 肉毒桿菌瘦臉 脈衝光 除斑 Flex PCB PCB RF PCB Rigid-Flex PCB Electronic PCB

Anonymous said...

板橋法拍屋 大台北法拍屋 原裝進口燈飾 流行燈飾 水晶燈 進口燈飾 吊燈 led燈 燈飾 燈具 照明 磁鐵 消毒 抽水肥 抽化糞池 化糞池 通馬桶 馬桶不通 通水管 水管不通 水管不通 化糞池清理 洗水塔 加盟創業 創業 加盟 早餐店加盟 創業加盟 pe膜 冬令營 冬令營 冬令營禮盒包裝 化妝品包 裝 紙盒 禮盒 化妝品盒 藥盒 彩盒 禮盒 印刷供應商 彩色盒 禮盒 設計 網版印刷 紙盒工廠 印刷公司 印刷 3D立體印刷 印刷服務 彩色印刷 包裝 設計breading machine food processing equipment frying machine meat processing equipment food processing mixers food forming patty machine boiling machine breading machine vegetable machine日立冷氣 電腦回收 回收 回收電腦 資源回收

Anonymous said...

This is really a good article,I like it very much.

wow goldcheap wow goldwow

buy wow goldwow gold
cheap wow goldbuy wow gold
World of Warcraft goldcheap World of Warcraft gold
World of Warcraft goldbuy World of Warcraft gold
World of Warcraft goldcheap World of Warcraft gold
buy World of Warcraft goldflyff

cheap flyff penyaflyff penyabuy

flyff penya
flyff penyacheap

flyff penya
buy flyff penyaflyff

flyff penyametin2 yangcheap metin2 yangmetin2

buy metin2 yangmetin2 yangcheap flyff penya
buy metin2 yangmetin2 yangluna goldcheap luna gold
luna goldbuy luna

luna goldcheap luna gold
buy luna goldluna gold<a


site said...

I consider everyone must read this.