-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
61 lines (48 loc) · 2.58 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Project Overview:
UC Berkeley CS 61B Project 2 (Spring 2017, Prof. Josh Hug):
Using Java to implement a relational database management system
controlled by SQL-like commands.
SCORE: 115.394 / 100.0
* Median score among UC Berkeley students: ~50.0 / 100.0
* I worked on this project while taking 19 units at UCLA, including Operating
Systems and Computer Architecture, because I wanted to learn Java and
explore projects from another university.
* Graded on Gradescope using UC Berkeley's public autograder. Extra credit
is awarded if you pass extra test cases.
Project Specifications:
http://datastructur.es/sp17/materials/proj/proj2/proj2.html
(or proj2.htm in the main directory)
===============================================================================
How to Compile and Run:
$ javac Main.java
$ java Main
$ <command(s)> (See Project Specifications: "Commands" and "Example")
$ exit
===============================================================================
I learned how to:
1.) Design a Table data structure after experimenting with standard data
structures like maps, lists, sets, and arrays.
Final Table Design (See db/Table.java for more details):
LinkedHashMap<Integer, LinkedHashMap<String, String>>
Some designs I thought about but abandoned after realizing flaws:
a.) String[][]
b.) HashMap<String, ArrayList>
c.) LinkedHashMap<String, LinkedHashMap<String, String>>
This one has a subtle difference from the final design, but
its use is too complicated to maintain and eventually becomes a
nasty problem in the join() function.
2.) Implement database management features, such as the
merging of two tables (via the "natural inner join" algorithm) and the
evaluation of column expressions and conditions used to extract desired
columns and rows from tables.
3.) Set a standard table format (.tbl), extract data from .tbl files
to load tables into the database, and store data from the database
into new .tbl files.
4.) Parse through and put into effect commands that the user inputs to
interact with the database, accounting for various combinations of
whitespace (a quite painful process).
===============================================================================
Notes to self:
1.) Stop using == to compare Strings. Use String.equals().
2.) Float comparisons using operators like ==, !=, etc. are incorrect.
Use Float.compareTo().