The Java 6 Annotation Processor
Whilst DSLs are less common in more mainstream languages such as Java than they are in Ruby, Smalltalk and Lisp, recent developments in the Java language, in particular the annotation processor which was added in Java 6, offer new possibilities for developers looking to use them in Java. The JPA 2.0 criteria API that will ship as part of Java EE 6, itself a DSL, offers an example. Here the annotation processor builds up a metamodel type for each persistent class in the application. Whilst it would be perfectly possible for the developer to hand craft the metamodel in Java, it would be both tedious and error prone. The use of the annotation processor eliminates that pain and, since the annotation processor is built into Java 6, the approach requires no specific IDE support – an IDE delegates to the annotation processor triggered by the compiler, and the metadata model is generated on the fly.
Using the annotation processor it is also possible for a library to add a new language feature. Bruce Chapmans prototype 'no closures' proposal, for example, uses the technique to provide a mechanism for casting a method to a Single Abstract Method (SAM) type which compiles on top of Java 6. During our conversation Chapman pointed out that the SAM type also supports free variables, a key aspect of a closure:
The method body can declare additional parameters beyond those required for the Single Abstract Method using the @As.Additional annotation. These parameters can have values bound to them at the point where you obtain an instance of the SAM type, and are then passed to the method each time it is invoked.
Chapman also set up the Rapt project to explore other uses of the technique, and has added implementations for two language changes - Multiline Strings and XML literals - that were considered for JDK 7 but wont now make it into the final release. Java could even get a form of closures support using this approach. When asked about this, Chapman said:
We are just finishing a Swing project which we used it for. We have found a couple of minor bugs around generic types, one recently discovered remains to be fixed but other than that it seems quite nice to use, and nobody has been wanting to rush back to use conventional anonymous inner classes.
Project Lombok, another project exploring the the annotation processor, pushes the technique still further. In effect Lombok uses annotation processing as a hook to run a Java agent that re-writes various javac internals based on the annotations. Since it is manipulating internal classes it is probably not suited to production use (internal classes can change even between minor releases of the JVM) but the project is an eye-opening example of just what can be done using the annotation processor, including:
bull; Support for properties using a pair of @Getter and/or @Setter annotations with varying access levels, e.g. @Setter(AccessLevel.PROTECTED) private String name;
bull; The @EqualsAndHashCode annotation, which generates hashCode() and equals() implementations from the fields of your object
bull; The @ToString annotation, which generates an implementation of the toString() method
bull; The @data method, which is equivalent to combining @ToString, @EqualsAndHashCode, @Getter on all fields, and @Setter on all non-final fields along with a constructor to initialize your final fields
Other language experimentation, such as removing checked exceptions from Java, can also be done using this approach.
Whilst the annotation processor technique opens up a welcome new route to language experimentation, care needs to be taken that the generated code can be easily read by developers, not just by the machine. Chapman made a number of suggestions during our conversation:Generate source code not bytecode, and pay attention to formatting (indenting especially) in the generated code. The compiler wont care whether it is all on one line or not, but your users will. I even sometimes add comments and javadoc in the source code generated by my annotation processors where appropriate.
Hopefully if the technique becomes more prevalent IDEs will also make it easier to view the code that is to be generated at compile time.
Syntactic Sugar in the IDE
Bruce Chapman also touches on our third technique - moving the syntactic sugar from the language to the IDE - in his blog and he elaborated on his ideas during our conversation. It is already routine for Java IDEs to create portions of boilerplate code for you such as the getters and setters of a class, but IDE developers are beginning to push the concept further. JetBrains IntelliJ 9 offers a terse code block syntax for inner classes similar to a closure, which a developer can also type. Acting like code folds, these can then be expanded into the full anonymous inner classes which the compiler works with - this allows developers who prefer to stick with the standard anonymous inner class syntax to do so. A similar plug-in for Eclipse also exists. The key point here is that the 'alternate' syntax is just a view of the actual code which the compiler and any source management tools continue to work with. Thus the developer should be able to switch views between either form (like expanding or collapsing a code fold), and anyone without access to the definition of the sugar just sees the normal Java code. Chapman writes:There are many details to work out in order to make this easily accessible, but long term I see developers relatively easily defining a two way sugaring/desugaring transformation (jackpot is a good start for how this might be done), trying them out, evolving them and sharing the good ones with colleagues and the community. The advantages of this are almost the same as for a language change, without the disadvantages. The very best could become ubiquitous and then form the basis of an actual language change i
剩余内容已隐藏,支付完成后下载完整资料
一种新型的基于Web的在线考试系统的计算机科学教育
Yuan Zhenming1, Zhang Liang2, Zhan Guohua3
摘要
基于Web的网上考试系统是一种为大众教育的评价有效的解决方案。我们已经开发一种在线考试系统,它是基于浏览器/服务器架构.该系统已经发布了考试和自动评级;是关于客观的问题和操作问题,以供客观的问题和经营问题他作为一个程序,经营的Microsoft Windows ,编辑的Microsoft Word , Excel和PowerPoint等等。她已经成功地应用于距离评价的基本操作技能的计算机科学,如过程的计算机技能,在大学和在全国范围内考试,为高中毕业生在中国浙江省进行实行。
关键字:考试系统、自动分级系统、基于Web和DCOM的系统
1. 导言:
在中国,基本电脑操作技能的教育已广泛展开.这项技术包括经营的Windows的MS Office ,网络技巧等等,这是结合不同的课程,以及作为电子政府的基础。现在,每一个本科生必须通过的计算机技能的考试.然而,每一位公务员必须通过相应的计算机操作考试过程。此外,在高中的过程中进行了计算机基础教育。自20世纪90年代末,在浙江省成千上万的人们开始参加不同的层次计算机教育和测试.这是非常有必要的,对于建立一个基于网络的学习和考试系统.它是为众多的人民,作为一个有效的解决办法去集体的学习和评价计算机基础教育的。
几个基于Web的学习和测试系统已经被设计完,比如说WebCT [1], QUIZIT[2] , ASSYST[3]和PILOT[4]。在线可以很容易使用最广泛的问题类型的基于Web的考试制度是客观的测试和测验,其中承担简单的答案可以正式检查和评估。典型的问题是以有/无问题,多-choice / singleanswer问题有限的, multiple-choice / multiple-answer问题,并填写在的问题与一个字符串和数值答案。[5]丰富类型的答案在这个系统中需要中年级学生或教员在这些系统需要手动的分级过程。此外,这些系统不支持的测试操作技能,例如在用户端电脑的windows打印机设置的运作和Word编辑等等。
我们的考试制度,为基本的计算机操作技能有以下特点:
- 问题的类型,它不仅包括客观的问题,而且还经营如: Windows ,MS Word文字,使用MS Excel ,上网技巧等等的问题。
- 学习和测试系统的目标是培养一个人的实用技能。因此,最好的学习方法是经营和测试在实际环境的客户机之上。
(3)这是迫切需要建立一个自动分级系统,以可分级经营的问题和客观问题为目的。然而,往往是基于Web的学习和测试系统不能支持这样的功能。
我们已经开发了一种新型的在线考试系统的.它是基于利用国家的最先进的电脑技术Browser/Server framework.它是实行电脑基本操作技能考试,主要包括客观的测试、Visual Basic编程,Microsoft Windows操作系统,Word ,Excel和PowerPoint的编辑,互联网和电子邮件的技术等等.他们也实施了在线自动划分等级。
2. 系统架构
我们基于Web的考试系统是一个基于DCOM技术的分布式协同系统。它有四个主要组成部分:考试准备制度系统,考试制度系统,考试监控系统和自动分级制度系统。
考试准备系统是用来管理的储存,转让试验编号及附表的考验等问题。该系统的数据库的组成问题是一套可能的答案,比如问题的类型和其他中继问题。这们是收录的几个因素,如主题,关键字,复杂性和困难性等等。而其数据库对教师是开放的,并且允许他们新增的问题和答案以模板的形式。考试制度是为学生提供一个基于网络的测试界面接口的,它之所以被叫做所谓的WOES,是以为其中包括以下主要特点:客户端控制,时间控制,安全控制和自动安装控制。受益于DCOM技术,该系统可以安装和更新本身的方便,它优越于C / S的框架。由于该系统是建立在网络上的,该系统的安全性问题面临着严峻的挑战。我们保证安全的加密技术,实时监测系统和数据传输加密。密码是用来验证学生鉴定前的测试。
真正的实时监控系统是要求学生在电脑测试期间利用人的脸跟踪技术保
证学生不离开电脑。系统对传递的试题数据进行传输加密,通过网络并以加密的形式传送到服务器。考试监控系统也是经理人考试制度,其中我们可以监控测试加工,进行试验编号统计,并收集答案等等。自动分级制度是设计的模糊匹配算法和宏观调控的编程技术,这是经验丰富的具有可变的问题类型。
- 基于Web在线考试系统
3.1 考试制度目的
作为一个普遍性的考试制度,基本的电脑操作教育,它必须满足下列要求:
1)存储一个合理的问题,必须要符合一般的考试大纲;
2)有两种类型的考试界面。一个是模拟一种实用的接口,另一种是实际环境。第二个计划,因为实际的性质的计算机技能将给予学生更大的灵活性;
3)一系列的问题类型,例如客观的问题,经营问题,设计问题,信息检索,测试组等等;
4)一种安全和可靠的考试制度。
3.2 WOES的组成
基于Web的在线考试系统(WOES)是一个多层次的系统组成的Web服务器,数据库服务器, WOES的中间件服务器,WOES客户端模块和浏览器,如Internet Explorer 。在这个系统中,我们使用Internet Information Server 4.0(IIS)的作为Web服务器,数据库服务器是Microsoft SQL Server 7.0的。核心的WOES是WOES中间件服务器和WOES的客户端模块,这是设计是据微软的DCOM标准。 DCOM是二进制COM对象的延伸拔节局域网,广域网和互联网,例如物体在不同的网络它可以约束。它是一种先进的网络协议用来配合基于COM的组成部分,这两个进程在不同的地点。该WOES中间件服务器是一个服务器端组件提供通信接口之间的WOES客户端和Web服务器或数据库服务器。该WOES客户端是一个客户端组件,就是所谓的由浏览器来控制用户端电脑,并提交或接收的信息从服务器的WOES。这种技术保证的灵活性和潜力,延长测试系统。此外,它允许访问本地文件,而在传统的系统,防止此类访问,即安全。
从DCOM中受益,从WOES中间件服务器在互联网上,WOES的客户可以下载或自动更新。他们也可以从一个客户端与其他WOES服务器沟通。该系统的行为像一个Agent社会,这是一个集中的代理人控制系统,不仅仅是WOES服务器。
3.3 WOES的关键技术
1)友好的用户界面
我们使用浏览器作为我们的用户界面。该浏览器界面有一个统一和一致的用户界面。几乎每个人都能够熟练地使用它。因此,它可以消除分歧,各种考试制度和保证一个公平的考验。
2)简化系统维护
由于该系统是基于浏览器/服务器架构,教师不仅在服务器上可以更新系统或数据库的问题或研究学生的数据库。这是没有必要必须做更新客户端系统为客户机/服务器的事。
3)中央考试管理
从中央控制系统,教师可以轻松控制考试过程中获利,如期初和期末考试,收集的答案和监测学生的条件在教师的屏幕上。4)安全最严重的困难,其中基于B / S系统面临的是安全,因为在原则上基于Web的考试制度可以访问互联网上或在一个城市的WAN。所有问题,材料和传送的答案都是在比特流格式后,编码,而不是以文件格式。在传输过程中,它可以不仅确保安全,而且还防止从外入侵。当一个学生开始他的测试,根据他的客户端的硬体和作业系统环境,该系统将产生一个密码分配给他。它可以防止其他客户登录模仿这名学生。最新的方法是利用人脸检测与识别技术以防止遥远的学生离开客户端。
开始考试前,在整个现场学生坐在电脑摄像头前可以监控。然后,系统会自动承认学生的脸和鉴定。尽快审定执行,学生必须留在摄影机前,直到考试结束。
4. 动分级制度
自动分级系统可以根据分数自动分级,它有助于教师以达到评分与安心收集到资料的考试制度。有两种类型的等级:客观的问题和经营问题。客观的问题,如选择题,是/否的问题,并填写问题,可以有效地分级准确匹配或模糊匹配。但它是很难由简单的匹配技术分级经营问题。一个可能的解决办法可以是:(1)它的关键文件是直接和比较的读应答文件。不过,这并不可行,因为Microsoft Office格式是一个复杂的档案。另一种解决办法是:(2)分级使用Office的OLE对象。这种方法是方便和有效率的,但它有一个大缺点:源代码的分级制度是密切相关的具体问题,当问题改变时,从而导致了大量工作。基础上我们是进行一个数据库的关键知识进而提出一个普遍化的评级制度。
首先,我们提取所有可能的知识点,并将其存储在三重形式:(关键,价值,位置)。然后,我们产生,文件标记的问题,直接指向对的问题;该系统将添加相应的问题,关键是要标准的图书馆规则。因此,最后的过程中自动分级制度是比较应答文件与标准的图书馆规则。自动分级系统还允许教师为我们的考试制度添加他/她自己的问题。
5. 结论
我们已研制出一种整体解决方案,为实用的计算机技能的各种问题的考试制度。它提供了一个友好的用户平台为计算机基础教育在大学,公务员培训,并在全国范围内和在浙江省高中毕业生的考试,数以十万计的学生和教师利用这一系统,并认为它有效地提高了学习和测试的效率。
6. 参考文献
[1] WebCT,“网络课程的收费”,http://www.webCT.com。
[2] Tinoco, L., Fox, E. and Barnette, D. “基于WWW上的网上课件”,In Proceedings of the 28th SIGCSE Technical Symposium(1997), pp. 194-198。
[3] Jackson, D., Usher, M. “使用ASSYS程序评价学生”, In Proceedings of the 28th SIGCSE Technical Symposium (1997), pp.335-339。
[4] Stina, B., Michael T., Stephen G., Roberto T.,“试验:一个互动的工具,学习和分级”, SIGCSEB: SIGCSE Bulletin,2000。
[5] Peter Brusilovsky and Philip Miller,“基于Web的测试,远程教育”, Proceedings of WebNet99, World Conference of the WWW and Internet,Honolulu, HI, Oct.24-30,1999, AACE, pp. 149-154
[6] RuiMin Shen, Yiyang Tang, Tongzhen Zhang, “智能评估系统在基于Web的远程学习教育”, FIE 2001。
A New Web-Based Online Examination System
For Computer Science Education
Yuan Zhenming, Zhang Liang, Zhan Guohua
Abstract
Web-based Examination System is an effective solution for mass education
evaluation. We have developed a novel online examination system based on a Browser/Server framework which carries out the examination and auto-grading for objective questions and operating questions,such as programming,operating Microsoft Windows, editing Microsoft Word, Excel and PowerPoint, etc. It has been successfully applied to the distance evaluation of basic operating skills of computer science,such as the course of computer skills in Universities and the nationwide examination for the high school graduates in Zhejiang Province,China.
Index Terms : Examination system, Auto-grading system, Web-based, DCOM
1. Introduction
In China, the education for basic computer operating skills has been broadly
launched. The skills include the operating of Windows, MS Office, Networking skills, etc., which are the foundation of a combination of different courses, as well as of el
剩余内容已隐藏,支付完成后下载完整资料
资料编号:[499790],资料为PDF文档或Word文档,PDF文档可免费转换为Word
以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。