Objectify: A Better Way to Build Rails Applications
For almost 6 years, the dominant"best practice" for building rails applications has beenskinny controller, fat model. In other words, put all ofyour business logic in to your models — keeping it out of your controllers. Theresult is typically a small number of bloated objects that are impossible toreason about or test in isolation [1].
That property is important. To understandwhy, let's take a quick and highly selective look at the origins of objectoriented programming.
OnEncapsulation
One of the early papers that emphasizedthe importance of encapsulation in software development was James H. MorrisJr.'s Protection inProgramming Languages. He argued that if we were going to beable to write correct software, “programs” (probably most analogous to objectsin the OOP world) needed “protection” from each other.
...hostilityis not a necessary precondition for catastrophic interference between programs.An undebugged program, coexisting with other programs, might as well beregarded as having been written by a malicious enemy—even if all the programshave the same author!
Weoffer the following as a desideratum for a programming system: A programmershould be able to prove that his programs have various properties and do notmalfunction, solely on the basis of what he can see from his private balliwick.
The idea is that if we can prove thatcomponents work in isolation, then we have a better chance of having afunctioning system when we assemble them in to a larger whole.
Aside from being central to the thesis ina paper that heavily influenced the development of object oriented programmingitself, it doesn't seem like a stretch to argue that components that areprovably correct in isolation would make a good building block from which tobuild working systems [2].
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-731249/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- a-better-way-to-find-literal-sqls-in-oracle-10g/SQLOracle
- Modular Rails: The complete Guide to Modular Rails Applications 筆記AIGUIIDEAPP筆記
- Build Desktop Applications Using Node.JSUIAPPNode.js
- 《Crafting Rails 4 Applications》的筆記-第28頁RaftAIAPP筆記
- Better And Better for Mac - Mac手勢神器BABMac
- Using lxml.objectify to Parse XML With PythonXMLObjectPython
- The Way to HappinessAPP
- The Way To Go --- 切片Go
- Better than better,白山EC2.0釋出
- Better data, better finance-方以涵NaN
- oracle 豎表,橫表(a stupid way,want the smart way)Oracle
- Ship Better Code
- [Rails學習之路]Rails路由配置AI路由
- HOW TO INTEGRATE APPLICATIONS RELEASE 11 WITH CUSTOM APPLICATIONSAPP
- Applications 5APP
- 精簡版的Rails框架->Rails::APIAI框架API
- Writing Better AdaptersAPT
- Why MVC is Better?(翻譯)MVC
- Why Java is better than .NETJava
- 演算法之路 - Way to Algorithm演算法Go
- POJ 2891 Strange Way to Express IntegersExpress
- Learning Django: the hard way (1)Django
- 【棧】RailsAI
- Ruby on Rails 生成指定版本的 Rails 專案AI
- rails on ruby,ruby on rails 之程式碼塊(二)AI
- Applications1APP
- Dependencies of Applications (256)APP
- Graph Theory with ApplicationsGraph TheoryAPP
- better-scroll滾動不了
- 從Rails到Clojure再到Java,最後回到RailsAIJava
- New way to deploy SSL VPN in LinuxLinux
- The Best Way to Export an SVG from SketchExportSVG
- Get table and index DDL in the easy way(轉)Index
- Python: Choice of the one obvious way to do itPython
- 推薦 | 通往AGI之路(Way to AGI)
- Rails Security (上)AI
- Rails安裝AI
- Rails Code QuestionsAI