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

查看:186
本文介绍了重构经典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.

我采取的一个基本步骤是重构页面到subs和函数有意义的名称,所以至少它很容易理解@顶部的文件通常是怎么回事。

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脚本在项目中,几千行长;)UGH!

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.

管理不是在寻找重写。

由于你一直在rails上做ruby,你的(VB / C#)ASP.NET最多是可以通过的。

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

strong>我的经验

My experience

我也继承了一个经典的ASP系统,它被ex excel-vba类型打包在一起。有很多这样的东西< font size = 3> crap< / 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和cTags(如 jamging 所述)上面)和一堆其他插件。

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.

请使用类。他们是超原始的(没有继承),但作为堵塞说,他们可以方便。

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

正确缩进脚本。

注释

编写外部架构文档。我个人使用LyX,因为它是脑死了,以产生一个格式很好的pdf,但你可以使用任何你喜欢的。如果您使用wiki,请安装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.

在业务逻辑单元测试中,我发现唯一的工作是设置一个xml-rpc监听器在asp中,它导入主库并公开任何主库的子包中的函数(而不是子程序),然后单独构建一个单元测试系统,语言更好地支持调用ASP的东西函数通过xml-rpc。我使用python,但我认为Ruby应该做的伎俩。 (那有意义吗?)。很酷的是,编写软件的单元测试部分的人不需要查看ASP代码,只要他们有可调的函数的描述,所以他们可以是你身边的人。

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.

在sourceforge有一个名为 aspunit 的项目但最后一个版本是在2004年,它被标记为非活动。从来没有使用它,但它是纯vbscript。粗略的看看代码告诉我看起来像作者知道他们在做什么。

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天全站免登陆