我是一个有点高级的C++/Java开发人员,最近对Python很感兴趣,我非常喜欢它的动态类型和高效的编码风格。目前,我将它用于解决编程谜语和脚本等小的编程需求,但我很好奇是否有人在企业质量的项目中成功地使用了Python?(最好使用现代编程概念,如OOP和某种类型的设计模式)
如果是这样的话,请您解释为什么(特别是)选择Python,并给我们一些您从这个项目中学到的课程?(可以将Python在项目中的使用与Java或等等进行比较)
发布于 2009-03-23 11:11:11
我正在使用Python开发一个复杂的保险承保应用程序。
我们的应用软件本质上重新包装了我们的精算模型,使公司可以订阅它。这项业务是基于我们的精算师和他们的深思。我们没有包装一个相对固定的聪明算法。我们通过网络服务将我们的精算大脑出租给客户。
精算师必须自由地进行变革,因为他们对导致索赔的各种因素有了更深入的了解。
- Static languages (Java, C++, C#) lead to early lock-in to a data model.
- Python allows us to have a very flexible data model. They're free to add, change or delete factors or information sources without a lot of development cost and complexity. Duck typing allows us to introduce new pieces without a lot rework.
- Static languages need complex mapping components. Often some kind of configurable, XML-driven mapping from customer messages to our ever-changing internal structures.
- Python allows us to have the mappings as a simple Python class definition that we simply tweak, test and put into production. There are no limitations on this module -- it's first-class Python code.
- Static languages require a lot of careful planning and thinking to create yet another demo, yet another mapping from yet another customer-supplied file to the current version of our actuarial models.
- Python requires much less planning. Duck typing (and Django) let us knock out a demo without very much pain. The data mappings are simple python class definitions; our actuarial models are in a fairly constant state of flux.
- Static languages bind in assumptions about the contracts, and require fairly complex designs (or workarounds) to handle the brain-farts of the business folks negotiating the deals.
- In Python, we use an extensive test suite and do a lot of refactoring as the various contract terms and conditions trickle down to us. 每周我们都会遇到这样的问题:“我们能处理X这样的条款吗?”我们的标准答案是“绝对”。然后是一个小时的重构,以确保我们能够处理它,如果交易是以这种形式达成的。
- Static languages don't have to ship source. Don't like the security model? Pay the vendor $$$.
- Dynamic languages must ship as source. In our case, we spend time reading the source of Django carefully to make sure that our security model fits cleanly with the rest of Django. We don't _need_ HIPAA compliance, but we're building it in anyway.
- With a static language, you have API's, you write, you run, and you hope it worked. The development cycle is Edit, Compile, Build, Run, Crash, Look at Logs; and this is just to spike the interface and be sure we have the protocol, credentials and configuration right.
- We exercise the interface in interactive Python. Since we're executing it interactively, we can examine the responses immediately. The development cycle is reduced to Run, Edit. We can spike a web services API in an afternoon.
发布于 2009-03-23 10:06:25
我一直在世界上最大的银行之一使用Python作为分布式计算框架。之所以选择它,是因为:
开发和部署新的functionalities;
https://stackoverflow.com/questions/672781
复制相似问题