最佳实践重构传统的ASP? [英] Best practices for refactoring classic ASP?

查看:131
本文介绍了最佳实践重构传统的ASP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须做一些显著的发展在一个大的,旧的,面条缠身ASP系统。我已经离开ASP很长一段时间,专注于Rails开发我的精力。

I've got to do some significant development in a large, old, spaghetti-ridden ASP system. I've been away from ASP for a long time, focusing my energies on Rails development.

我已经采取的一个基本步骤是重构的页面进入潜艇和功能有意义的名称,这样至少很容易理解@什么通常会在文件的顶部。

One basic step I've taken is to refactor pages into subs and functions with meaningful names, so that at least it's easy to understand @ the top of the file what's generally going on.

是否有ASP一个有价值的MVC框架?或在最佳实践如何,至少让业务逻辑出了意见? (我记得做了很多,包括早在一天的 - 现在仍然是这样做)

Is there a worthwhile MVC framework for ASP? Or a best practice at how to at least get business logic out of the views? (I remember doing a lot of includes back in the day -- is that still the way to do it?)

我很想得到一些单元测试去为商业逻辑,但也许我要求太多了?

I'd love to get some unit testing going for business logic too, but maybe I'm asking too much?

有超过200个ASP脚本的项目,几千排长;!)消化道出血

There are over 200 ASP scripts in the project, some thousands of lines long ;) UGH!

我们可能会选择大重写但在那之前,我在改变页面的时候,我想花一点额外的时间清理面条。

We may opt for the "big rewrite" but until then, when I'm in changing a page, I want to spend a little extra time cleaning up the spaghetti.

推荐答案

假设

对于经典ASP系统的文档是相当轻。

The documentation for the Classic ASP system is rather light.

管理是不是找一个重写。

Management is not looking for a rewrite.

既然你已经在轨道上做红宝石,你(VB / C#)ASP.NET还说得过去的最好的。

Since you have been doing ruby on rails, your (VB/C#) ASP.NET is passable at best.

我的经验

我也继承了由前Excel的VBA类型拼凑不管三七二十一一个传统的ASP系统。有很多这方面的东西<字体大小= 3>垃圾< / FONT> (有时缺少结束标记;!Argggh)。在2。5年的过程中,我添加的安全系统,公用库,CSS + XHTML,并能够强制验证XHTML1.1(没有适当的MIME类型,不幸)的东西,并建立了的是一个相当强大和ajaxy报告制度每天80用户使用。

I too inherited a classic ASP system that was slapped together willy-nilly by ex excel-vba types. There was a lot of this stuff <font size=3>crap</font> (and sometimes missing closing tags; Argggh!). Over the course of 2.5 years I added a security system, a common library, CSS+XHTML and was able to coerce the thing to validate xhtml1.1 (sans proper mime type, unfortunately) and built a fairly robust and ajaxy reporting system that's being used daily by 80 users.

我用的jEdit,与和一群其他插件(如上面的 jamting 提到)CTAGS。

I used jEdit, with cTags (as mentioned by jamting above), and a bunch of other plugins.

我的忠告
尝试创建一个主包括从中导入一个通常使用的所有东西文件。这样的东西登录/注销,数据库访问,Web服务,JavaScript的库等。

My Advice Try to create a master include file from which to import all the stuff that's commonly used. Stuff like login/logout, database access, web services, javascript libs, etc.

不要使用类。他们是超原语(没有继承),但作为jamting说,他们可以方便的。

Do use classes. They are ultra-primitive (no inheritance) but as jamting said, they can be convenient.

缩进脚本正常。

注释

写外部架构文档。我个人使用LyX的,因为它是死脑筋,产生很好的格式化的PDF格式,但你可以使用任何你喜欢的。如果您使用维基,获得graphviz的附加安装并使用它。这是超级容易赚快图表,可以轻松地修改。

Write an external architecture document. I personally use LyX, because it's brain-dead to produce a nicely formatted pdf, but you can use whatever you like. If you use a wiki, get the graphviz add-in installed and use it. It's super easy to make quick diagrams that can be easily modified.

由于我不知道该如何增强大幅度需要的话,我建议有一个良好的高层到中层架构文件将在规划的增强非常有用。

Since I have no idea how substantial the enhancements need to be, I suggest having a good high-level to mid-level architecture document will be quite useful in planning the enhancements.

在业务逻辑的单元测试,我发现唯一的作品是建立在ASP中的XML-RPC监听器,在任何主库的进口主库,并公开功能(不子程序虽然)子包括,然后再建,分别在语言单元测试系统,支持通过XML-RPC调用ASP功能的东西,更好的支持。我使用Python,但我认为红宝石应该做的伎俩。 (那有意义吗?)。很酷的事情是,编写软件的单元测试部分人并不需要,甚至看ASP code,只要他们拥有的功能体面的描述来电话,让他​​们可以在你身边的人。

On the business logic unit tests, the only thing I found that works is setting up an xml-rpc listener in asp that imports the main library and exposes the functions (not subroutines though) in any of the main library's sub-includes, and then build, separately, a unit test system in a language with better support for the stuff that calls the ASP functions through xml-rpc. I use python, but I think Ruby should do the trick. (Does that make sense?). The cool thing is that the person writing the unit-test part of the software does not need to even look at the ASP code, as long as they have decent descriptions of the functions to call, so they can be someone beside you.

有一个名为 aspunit 在SourceForge项目,但最后一个版本是在2004年,它的标记为非活动状态。从来没有使用过它,但它是纯粹的VBScript。粗略地看一下code告诉我,它看起来像的作者知道他们在做什么。

There is a project called aspunit at sourceforge but the last release was in 2004 and it's marked as inactive. Never used it but it's pure vbscript. A cursory look at the code tells me it looks like the authors knew what they were doing.

最后,如果你需要帮助,我有一些可用做远程办公合同工作(也许8小时/周最大值)。遵循联系信息链接的踪迹。

Finally, if you need help, I have some availability to do contract telecommuting work (maybe 8 hours/week max). Follow the link trail for contact info.

祝你好运! HTH。

这篇关于最佳实践重构传统的ASP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆