案例CS之Haskell冷门编程Computer Science
当前位置:以往案例 > >案例CS之Haskell冷门编程Computer Science
2017-09-07

Learning Outcomes:

On successful completion of this assessment item a student will have demonstrated competence in the following areas:

· [LO1] explain the key concepts in the four main programming paradigms and characterise the nature and compare the applicability of programming paradigms in the context of a given problem scenario. Justify your solution from the architectural perspective of the paradigm you choose.

· [LO2] design a formal definition of a functional problem solution.

· [LO3] Implement the solution in a purely functional programming language

Requirements

Problem Scenario:

A cryptography company has consulted you to implement a simple but crucial text editor system as part of a major contract with a security company to provide fully cloud-based services to a private operator in private equity establishment. Due to security concerns and for a risk of compromising data, your client avoids using the publically available commercial software.

The text editor will be used to record transactions keys of VIP clients from the transactions contained within a multi-platform application controlled from high-end business servers. The passing of data between systems will be handled by a separate team in a sister company so you do not need to concern yourself with the functionality of any other part of the proposed system other than the text editor. The text editor will largely be controlled using trigger commands, but again, you do not need to be concerned with this aspect of the system.

You are to be given ONE opportunity to question a potential user of the system who will provide answers to any questions you might have about the functional requirements of the system. If you are unable to attend the Q&A Session then it is your responsibility to establish suitable mechanisms to ensure you get all of the information you need in order to complete the required tasks.

Your text editor should be able to save and retrieve data from files. Ideally, it should have a user interface – but this is not a core requirement. The text messages that your editor will have to deal with are by definition short and will be constructed wholly as a single line of text and no character formatting will be required.

At this moment in time, your Team Leader does not know which programming paradigm will be used to implement the system and has therefore asked you to provide a short written report detailing the advantages and disadvantages of each of the four main paradigms as solution mechanisms for this particular contract.

You have also been asked to provide an ADT specification for the proposed Text Editor which is presented in the house style and an implementation in Haskell so that your team leader can demonstrate a functional solution to the Department Head. This specification should include formal definitions of all operations that are deemed necessary to fulfill the user requirements.











Your tasks are presented in summary form below (the weighting of each task is provided in the accompanying Criterion Reference Grid):

TASK ONE

You should prepare a brief report that considers the general advantages and disadvantages of each of the four programming paradigms in the context of this particular problem scenario, and also give a justified recommended choice for implementing the final solution to this particular problem.


You can refer to specific languages to exemplify your response, but a generic paradigm discussion will be acceptable. Your discussion should be beyond simple commentary of features and should be backed by brief a theoretical perspective of the chosen paradigm.


TASK TWO

You are required to use the house style for ADT specification to formally define the functionality of the text editor ADT. A previously constructed (but unconnected) ADT specification that formed the foundation of a timer mechanism in one of the surgery machines (Clock ADT) is presented below as an exemplar of the house style. You should be sure to stick to the conventions implied by this specification when constructing your ADT definition.


TASK THREE

The final task requires you to implement the text editor in Haskell to the full specification you wrote in Task Two. You can also choose any other functional language of your choice.


You should submit your Haskell code as a written transcript within your formal submission but you are not required to submit the code files. Additionally, you should submit a short video (less than 1 minute in length) which shows your implementation running while you describe what you have done to implement the ADT in Haskell. You should provide a commentary as you give a demonstration of some of the key functions created. You will not be assessed on the quality of the recording.


The short video should be captured with free software such as Screencast-O-Matic (http://www.screencast-o-matic.com). Download and install the software. Using the ‘free version’, follow the instructions to capture your video. When the video is complete select ‘Upload to YouTube’. Upload your video as an ‘unlisted’ video (this allows us to see the video, but only when you tell us of its URL).


You should then include the URL of your YouTube video with your written submission.


ENHANCEMENT TASK

For extra points, you should implement your solution with a graphical user interface, developed either in Haskell or any other language that you can port on the Haskell implementation. You should demonstrate key ideas and advance functionality of Haskell, beyond a peripheral basic solution.



HOUSE STYLE EXAMPLE





NAME SETS

Clock – an ADT representing a simple (non-timing, non-calendar) time piece C the set of clocks, { (N × N × N ) }

N the set of Natural numbers ( "n.nÎ Z Ù n ³ 0)





SYNTAX

create:

^

®

C

destroy:

C

®

^

init:

C

®

C

getSeconds:

C

®

N

setSeconds:

C × N

®

C

getMinutes:

C

®

N

setMinutes:

C × N

®

C

getHours:

C

®

N

detours:

C × N

®

C

alter:

C × N

®

C


SEMANTICS

"h.hÎN, "m.mÎN, "s.sÎN, "z.zÎN

pre-create():: true

post-create(r):: r = ( 0 , 0 , 0 )

pre-destroy(c):: true post-destroy(c; r):: r = ^

pre-init(c):: true

post-init ((_,_,_); r):: r = ( 0 , 0 , 0 )

pre-getSeconds(c):: true

post-getSeconds((_,_,s); r):: r = s

pre-setSeconds(c,n):: n < 60

post-setSeconds ((h,m,_),z; r):: r = ( h , m , z )

pre-getMinutes(c):: true

post-getMinutes((_,m,_); r):: r = m

pre-setMinutes(c,n):: n < 60

post-setMinutes ((h,_,s),z; r):: r = ( h , z , s )

pre-getHours(c):: true

post-getHours((h,_,_); r):: r = h

pre-setHours(c,n):: n < 24

post-setHours ((_,m,s),z; r):: r = ( z , m , s )

pre-alter(c , n):: true

post-alter ((h , m , s), z; r):: r =( (h + (m + (s + z) DIV 3600) MOD 24 , (m + (s + z) DIV 60) MOD 60 , (s + z) MOD 60 )


AUTHOR

Kevin Jacques ([email protected]). Feb 2017



Useful Information

Your work must be presented according to the School of Computer Science guidelines for the presentation of assessed written work.


Please make sure you have a clear understanding of the grading principles for this component as detailed in the accompanying Criterion Reference Grid.


If you are unsure about any aspect of this assessment component, please seek the advice of a member of the delivery team.

Submission Instructions

The deadline for submission of this work is included in the School Hand-in Dates spreadsheet on Blackboard.


DO NOT include this briefing document with your submission.


在线提交订单