首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
Programming语言程序讲解、辅导java编程设计 讲解SPSS|辅导留学生Prolog
项目预算:
开发周期:
发布时间:
要求地区:
Informatics 1: Object Oriented Programming
Assignment 2 – Understanding and reviewing code
Overview
This assignment is designed to give you experience in reading and understanding code that is not
your own. In so doing, you should learn to value well written code and gain an appreciation for
documentation. You are set three tasks, described in the Basic, Intermediate and Advanced sections
below. All your answers will be written up in the form of a report.
Basic: From code back to the specification
Usually, you are asked to write code to a given specification. Doing so can be seen as translating a
natural language to a programming language. The translation process is prone to error and requires
a lot of attention to detail. Once you have a prototype solution, it is useful to check that it does
exactly what it was supposed to. One way of spotting disparities between what the code actually
does and what was intended, is to have the programmer describe the program in their own words.
Comparing this to the initial specification can reveal important differences. Your first task is to
write such as a reverse translation i.e. work out the specification to which the given code appears to
have been written.
Step 1: Download the code
The program to be analysed is called PrecipitationGraph and is included in Assignment2.zip, which
can be downloaded from LEARN (under Assessment → Assignment 2).
Step 2: Get an overview of the code
Look at the different classes and their methods to gain an overview of the largest components that
make up the program. Initially, focus only on the names of the methods and any comments
describing what they do. At this stage, it can be counterproductive to read the code in the body of
methods or comments pertaining to individual lines of code.
Step 3: Run the code
The class Test.java contains the main method, which exercises some of the features of the program.
You can run this without having to edit the code. You may want to experiment a bit more by calling
other methods or changing parameters. In so doing, you might break the code, which is deliberately
imperfect. Take note of any errors you find for the intermediate task if you are attempting it.
Marks will be awarded out of 100 and count for 20% of your overall grade for Inf1B. Each 20 credit
course is designed to involve around 200 hours of work. Of those, 9 hours have been allotted for
this assignment. Completion time may vary depending on your level of experience and the grade
you are aiming for. Details on marking criteria can be found in the eponymous section below.
Step 4: Look at the details of the implementation
Now it is time to get your hands dirty and dive into the code itself. Your aim should be to extract
implementation details. Beware of errors in the code! If you find something that looks wrong, try to
work out the programmer’s intention even if a feature was not implemented correctly. Take notes
while you are doing this, but do not correct any errors in the code.
Step 5: Make a list of the program’s features
Use your notes and overall understanding of the program to compose a list of features that you think
the programmer was trying to provide (whether they succeeded or not). Include this in your report
in the form of short, technical bullet points. You can can assume the reader will be a programmer.
This should not be a description of the implementation however. Another developer may want to
follow a different approach, so state what the program should be able to do rather than how features
should be implemented.
Step 6: Write a specification
Finally, write a matching program specification. This is essentially a prose version of the features,
but it should be less technical. Imagine you are commissioning this piece of software and have
never seen a single line of code. To make sure the programmers you are hiring produce something
useful, you need to provide a detailed, unambiguous description of your requirements.
Step 7: Go beyond the code
Since you are reverse engineering the specification from the code, you can only see the features that
are provided. The absence of some features may, however, be conspicuous. Try to come up with two
additional features the company may require and explain why these would be useful in your report.
A template for the report is provided. See the ReportTemplate folder in Assignment2.zip.
Intermediate: Code review
Now that you have a specification, you can evaluate the provided code against it. Your job is to
write a code review. This involves developers going over code written by other members of their
team with the aim of finding errors and suggesting improvements. Your feedback should provide the
creator of PrecipitationGraph with practical advice on how to improve their implementation.
You will be marked on the quality of your code review, which should be:
• Complete – cover all issues you can find
• Specific – focus on parts of the code that need to be improved, avoid giving vague feedback
• Constructive – propose actionable steps to improve the code
• Justified – provide explanations and give reasons for why a proposed change is beneficial
The following outlines the aspects to be covered in the code review. Please use a tabular format in
your report as shown in the template. You can format the table differently if you wish, but there
must be a clear separation between different issues.
Functional correctness
Evaluate the extent to which the program fulfils the specification (not including the requirements
you added in step 7). Explain any issues you find and provide ideas for how to solve them. This is
not asking you to find ways of crashing the program – that is more often an issue with robustness
(to be reported under code quality below). Instead, you are looking for errors in the logic or cases in
which the program does something different to what it was meant to do.
Code quality
List up to ten different issues you can find with the quality of the code. Explain why the code needs
to be improved and make a suggestion for how to do so. If you find the same type of issue multiple
times, only report one instance of it (preferably the worst offence).
Desirable qualities include, but are not limited to:
• Structure
◦ A good design should split the task into more manageable chunks (think divide and conquer)
e.g. by a meaningful division of the code into classes.
◦ Modularity and reusability: Classes and methods perform well defined tasks. They can be
seen as building blocks for solving many different problems, not just the task at hand. Long
methods are a symptom of a too problem-specific design.
◦ Code duplication is avoided.
◦ Extensibility: New features can be added without redesigning the whole program.
• Robustness
◦ The program is able to handle errors and invalid/unexpected inputs without crashing.
◦ Correct use of access level modifiers (public/private) and static to restrict exposure.
• Technical/language proficiency
◦ Use the appropriate features of your programming language. This means not restricting
yourself to building everything using a few keywords when there is a more elegant solution.
It also means not using a needlessly complex mechanism for solving a simple task.
• Readability (self-documenting code)
◦ Use descriptive but concise names for variables, methods and classes.
◦ Class names start with a capital letter, method and variable names with a lower case letter.
◦ AllNamesAreWrittenInCamelCase
◦ Exception: Static constants are written in SHOUT_CASE.
◦ Use consistent formatting throughout all classes.
Code documentation
Give two example each of where:
• more comments would be helpful
• needless or uninformative comments clutter or obscure the code
• comments are actively misleading, distracting or inappropriate
Advanced: Legacy code
One of the developers on your team has gone into retirement and the job of maintaining their code
has been dumped on you. In order to add a new feature, you must understand how the existing code
works. The class X.java (in Assignment2.zip) is particularly obscure. Your predecessor seems to
have been obsessed with efficiency and has no concept of code quality or documentation. All you
can tell from context is that it must be some kind of data structure. You now have to look at the code
to work out what it does. Hint: Look up bitwise operators and bit shifting.
For each method in X.java, do the following:
• State what the method does.
• Give it a more descriptive name.
• Explain in detail how the code works (not required for methods m5 and m6).
Finally, answer the following questions:
• What kind of data structure is this and what would be a better class name?
• What are the advantages and disadvantages of the chosen data representation?
• Is there any justification for writing code like this (why/why not)?
Please note that attempting the more difficult tasks only removes grade capping. It does not
guarantee a mark in the corresponding range. Your answers are graded on how complete, accurate
and well presented they are. A good solution to one task is preferable to a poor attempt at all.
Report
A template for the report is provided, but you should still aim for the following qualities:
• Content
◦ Answer questions directly without beating about the bush.
◦ Do not just write down everything you know about the topic, stick to what was asked.
• Structure
◦ Break the content down into well labelled sections.
◦ If you are making an argument, ensure you organise your points into a logical sequence.
◦ Try to make the text flow by avoiding frequent or abrupt changes of topic.
• Writing style
◦ Should be clear and concise. Make the report as short as possible without cutting essential
details.
◦ Avoid repetition: Make your point once and make it well, but avoid re-stating it.
Solving the task described in the Basic section is sufficient to obtain a grade (up to 49%).
Both basic and intermediate tasks must be solved for a grade (up to 79%).
You will need to tackle all three tasks to get an A (up to 100%).
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!