首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CSC173程序讲解、database编程讲解、辅导Java语言编程 讲解R语言编程|辅导R语言编程
项目预算:
开发周期:
发布时间:
要求地区:
CSC173: Project 4
The Relational Data Model
In this project you will gain experience with databases and relational algebra by implementing
your own database system. We will build on the presentation (and code) in the
textbook.
Note: Your writeup for this project will probably be more extensive than previous projects.
In addition to the usual instructions for building and running your project, please be sure
to describe what your program is doing and what we’re seeing. Of course, that should
also be clear from the output of the program by itself.
Part 1
1. Implement a database containing the relations (tables) shown in FOCS Figure 8.1
and 8.2 (also seen in class). Use the method described in Section 8.2 in the
section “Representing Relations” and elaborated in Section 8.4 “Primary Storage
Structures for Relations.” Use hashtables. Describe your implementation briefly
but clearly in your writeup.
2. Implement the basic single-relation insert, delete, and lookup operations as functions.
If you use the implementation described in the textbook, you will need separate
functions for each relation (e.g., insert CSG). You should support leaving
some attributes unspecified for delete and lookup (denoted with “*” in the textbook,
perhaps something else in your code). Describe your implementation briefly but
clearly in your writeup.
3. Use your insert method to populate the tables with (at least) the data given in the
figures. Then demonstrate all three operations by performing the operations shown
in Example 8.2 (p. 409). Be sure that your program explains itself when run (using
informative printed messages).
1
Part 2
For this part, use the database with all the tuples from Figures 8.1 and 8.2 (that is, before
any deletions).
1. Write a function to answer the query “What grade did StudentName get in CourseName?”
as described in Section 8.6 “Navigation Among Relations.” The code for
your function MUST look like the pseudocode in Fig. 8.8. (I recommend using the
pseudocode as comments in your code.) Demonstrate this functionality by asking
the user for the query parameters, performing the query, and printing the results
informatively (that is, a kind of REPL).
2. Write a function to answer the query “Where is StudentName at Time on Day?”
(assuming they are in some course). Demonstrate this functionality also.
Part 3
1. Implement the Relational Algebra operations as described in Section 8.8 and demonstrate
this by doing the operations on the “registrar” database described in Examples
8.12 (Selection), 8.13 (Projection), 8.14 (Join), and 8.15 (all three). Describe
your implementation briefly but clearly in your writeup.
• If you follow the implementation in the textbook, you will probably need a
different function for each different set of arguments to the operator (e.g.,
select CSG, join CSG SNAP). Only implement the ones that you need for
the examples listed above. You may also throw in any additional examples
that you feel illustrate relevant aspects of your implementation.
• Note that some of the Relational Algebra operations create a relation with a
new schema from that of their operands. (You should know which operations
do this. . . ) But if tuples are implemented using structs, how do you create
instances of these new “on-the-fly” relations?
The answer is that you should solve the problem yourself by hand so that
you know the schemas needed by your examples. Then add appropriate
structure definitions to your program to allow you to do the examples. This is
one of many differences between what you need to do for this project and a
real database framework.
2
Extra Credit (20% max total)
1. Implement functions for saving your database to one or more files, and loading
from the same. Demonstrate this functionality in your program(s) and explain in
your writeup. Note: you can do all the other parts of the project even without this
functionality, so don’t let it stop you or slow you down. [max 10% extra]
2. The code you wrote for the “registrar” database is obviously specific to it. A true
database system, like SQLite or MySQL, allows you to represent any database
schema. Generalize your code to represent arbitrary databases consisting of arbitrary
relations. Note that you do not need to understand SQL for this. What you
need to do is create “generic” representations of tuples and tables and then use
them to write code for some specific example.
If you choose to do this, and are confident in your implementation, you may use it
for the required parts of the project. Explain what you’ve done in your writeup and
we will give you the extra points if it all works. You may also choose to demonstrate
this separately, for example with another program. Again, be clear in your writeup
so that we can give you the points. [max 10% extra]
3. Identify a subset of SQL that you can support with your implementation. You should
focus on the query parts of the language, not the data definition parts. Write a
simple parser for that language, and use it to query (and perhaps also create) the
“registrar” database. Demonstrate this by also allowing the user to enter queries
and have your system parse and execute them and print the results. Explain what
you’ve done and how it will be demonstrated by the program(s) in your writeup.
[max 10% extra]
Project Submission
Your project submission MUST include the following:
1. A README.txt file or README.pdf document describing:
(a) Any collaborators (see below)
(b) How to build your project
(c) How to run your project’s program(s) to demonstrate that it/they meet the
requirements
2. All source code for your project. Eclipse projects must include the project settings
from the project folder (.project, .cproject, and .settings). Non-Eclipse
3
projects must include a Makefile or shell script that will build the program per
your instructions, or at least have those instructions in your README.txt.
3. A completed copy of the submission form posted with the project description.
Projects without this will receive a grade of 0. If you cannot complete and save
a PDF form, submit a text file containing the questions and your (brief) answers.
We must be able to cut-and-paste from your documentation in order to build and run
your code. The easier you make this for us, the better grade your will be. It is your
job to make both the building and the running of programs easy and informative for your
users.
Programming Policies
You must write your programs using the “C99” dialect of C. This means using the “-std=c99”
option with gcc or clang. For more information, see Wikipedia.
You must also use the options “-Wall -Werror”. These cause the compiler to report
all warnings, and to make any warnings into errors that prevent your program from compiling.
You should be able to write code without warnings in this course.
With these settings, your program should compile and run consistently on any platform.
We will deal with any platform-specific discrepancies as they arise.
If you submit an Eclipse project, it must have these settings associated with the project.
Projects with that compile with warnings will be considered incomplete.
Furthermore, your program should pass valgrind with no error messages. If you don’t
know what this means or why it is A Good Thing, look at the C for Java Programmers
document which has a short section about it. Programs that do not receive a clean report
from valgrind have problems that should be fixed whether or not they run properly. If
you are developing on Windows, you will need to look for alternative memory-checking
tools.
Late Policy
Late projects will not be accepted. Submit what you have by the deadline. If there are
extenuating circumstances, submit what you have before the deadline and then explain
4
yourself via email.
If you have a medical excuse (see the course syllabus), submit what you have and
explain yourself as soon as you are able.
Collaboration Policy
You will learn the most if you do the projects YOURSELF.
That said, collaboration on projects is permitted, subject to the following requirements:
• Groups of no more than 3 students, all currently taking CSC173.
• You must be able to explain anything you or your group submit, IN PERSON AT
ANY TIME, at the instructor’s or TA’s discretion.
• One member of the group should submit on the group’s behalf and the grade will
be shared with other members of the group. Other group members should submit
a short comment naming the other collaborators.
• All members of a collaborative group will get the same grade on the project.
Academic Honesty
Do not copy code from other students or from the Internet.
Avoid Github and StackOverflow completely for the duration of this course.
There is code out there for all these projects. You know it. We know it.
Posting homework and project solutions to public repositories on sites like GitHub is a violation
of the University’s Academic Honesty Policy, Section V.B.2 “Giving Unauthorized
Aid.” Honestly, no prospective employer wants to see your coursework. Make a great
project outside of class and share that instead to show off your chops.
5
Frequently Asked Questions
Q: In C, how can I make a hashtable that can hold any kind of tuple?
A: How would you do it in Java? Think about it. . .
Answer: Generics. And indeed java.util.Hashtable is a generic class.
Now, does C have generics? Answer: no. So this is an example of the
kind of thing added to Java as it evolved from C, in order to capture common
programming patterns more effectively. But if all we have is C, what can we
do?
For some dynamic data structures, you can just manage “generic” objects of
type void* and use casts as needed (I STRONGLY suggest that you encapsulate
the casts in helper functions).
The problem is that unlike a linked list, a hashtable needs to know something
about the objects it is managing. Why? Because it has to hash them,
which means accessing some of their components. So you need to be able
to tell the “generic” hashtable code which hash function to use for each type
of struct it will be managing. There are ways (e.g., function pointer in tuple or
hashtable), and they all amount to reinventing (in fact, pre-inventing) the idea
of true classes.
You could just cut and paste the code for different flavors of hashtable. So the
routines use the right type of struct for arguments and they know what hash
function to use. Is this ugly? Yes. Is it bad software engineering practice?
Yes. Is it ok for this project? Yes. This is similar to the business about the
schemas of tuples produced by JOIN operations, as described in the project
description Part 3.
If you were ambitious you might observe that the cut-and-paste method is
purely mechanical, other than writing the hash function itself. That is, you
basically go through and change all occurrences of the element type name
and that’s really all you need to do. Given that, you could define a macro or
macros that expanded into the code. Something like:
#define RELATION(ETYPE,HFUNC) ...
for element type ETYPE and name of hash function HFUNC. Using macros
is a bit of a power C programmer technique. But it is how we did “generic”
code back in the day, and as you may know, C++ grew out of just this kind of
macro-powered code.
You could also implement tuples using something other than structs, as described
in one of the Extra Credit problems. There are many possibilities. . .
6
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
urba6006代写、java/c++编程语...
2024-12-26
代做program、代写python编程语...
2024-12-26
代写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
热点标签
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
软件定制开发网!