This commit is contained in:
Jet Hughes 2022-05-07 12:44:09 +12:00
parent 2b8c007e90
commit 8f5488706c
10 changed files with 145 additions and 10 deletions

View File

@ -15,7 +15,6 @@ title: "Jet Hughes"
# 3 Projects
- [bug-tracker](notes/bug-tracker.md)
-
# 5 Independent Learning

View File

@ -10,13 +10,13 @@ The Notorious Byrd Brothers - The Byrds - spotify:album:5UI2X5VAmgu9xrlXDd5U7B
- [ ] use 1001 albums api
- [ ] 11:00 Cosc201 Lecture
- [ ] 12:00 Info201 Lab 8
- [ ] 13:00 Info201 Lecture
- [x] 13:00 Info201 Lecture
## Lecture/Labs
- [x] 11:00 Cosc202 Lecture
- [ ] 12:00 Cosc201 Lab
- [ ] 12:00 Info203 Tutorial
- [x] 12:00 Cosc201 Lab
- [x] 12:00 Info203 Tutorial
- [ ] 16:00 Info201 Lecture
## Assignments

View File

@ -0,0 +1,39 @@
[2022-05-05](daily_notes/2022-05-05) << [daily-notes](notes/daily-notes.md) >> [2022-05-07](daily_notes/2022-05-07)
---
# 06-05-22
Planet Rock: The Album - Afrika Bambaataa - spotify:album:3qX0GugLujpIodkT6r06hf
## Todos
- [ ] use 1001 albums api
- [ ] 11:00 Cosc201 Lecture
- [ ] 12:00 Info201 Lab 8
- [ ] 13:00 Info201 Lecture
- [ ] 16:00 Info201 Lecture
- [ ] info 202 api's lecture
## Lecture/Labs
- [ ] 09:00 Cosc202 Lab 7yhbn ,9
- [ ] 11:00 Cosc201 Lecture
- [x] 12:00 Info201 Lab
## Assignments
- Mobile app
- Brainstorming
## Projects
- python ai weekly review
## Links
### cosc 202
[lab book](https://cosc202.cspages.otago.ac.nz/lab-book/COSC202LabBook.pdf)
### info 201
- [cousework tiddlywiki](https://isgb.otago.ac.nz/infosci/INFO201/labs_release/raw/master/output/info201_labs.html#)
- [Assignments tiddlywiki](https://open.spotify.com/album/23DJ3KNE5JXi61G31T2Kni?si=-zZEHXIxT2qOEN6_Ns5C5Ql)

View File

@ -0,0 +1,95 @@
---
title: "17-data-access"
aliases:
tags:
- info201
- lecture
sr-due: 2022-05-08
sr-interval: 3
sr-ease: 250
---
[revision questions](https://i.imgur.com/mPmQ28v.png)
Most infosystems require persistent data. e.g.,
- save to file
- save to database
Some systems require several persistent data stores. e.g., multiple databases.
# File based
doesn't scale well
- demlimited text e.g., CSV TSV
- easy to create and process
- portable
- lowest common denominator
- structured text e.g., JSON, XML, YAML
- many tools for querying and transforming data
- portable also
- Serialiased data Structures (*usually* binary)
- more compact
- easy to do
- single user only
- no automatic failure recovery
- no querying
- versioning issues
- no standards
- less portable
# Databases
- managed by DBMS
- usually SQL based
- also noSQL for unstructured big data
- advantages
- multi user support
- transactions (failure recovery)
- (centralised) constraints and referntial integrity
- flexible and ad-hoc querying
* manage large data
# Database APIs
- most dbmss have a native datbase api
- usually proprietry and limited to just that product
- often the only option for noSQL dbmss
- also generic database apis
- work with multiple dbmss
- same code works with any supported dbms
- for sql dbmss
- ODBC microsoft
- JDBC java
- DB-API python
- PDO php
- DBI perl
# How to manage persistent data access
1. domain objects interact directly with the data store
- write to file or send sql statements
- not easy to change
2. domain objects interact with data store via a mediator
- either standalone class or implementation of a data access interface
- data access objects DAOs
- encapsulates all access to persistent data
# Designing DAOs
- general rule: one DAO per "logical unit" of data access
- many DAOs are just for one class e.g., `PatronDAO`
- some involve many classes
- things like header/lines objects are always managed together
- complex operations that join multiple tables or domain classes
- different use cases (features) use different sets of DAOs e.g.,
- add, find, edit patron ⇒ `PatronDAO`
- lend items ⇒ `LoanDAO`, `ItemDAO`, `PatronDAO`
- object construction and deconstruction coded into DAOs
## Multiple implementation of the same DAO
[DAO versions](https://i.imgur.com/UZzffto.png)
# JDBC for sql
- [jdbc slide](https://i.imgur.com/Dy79jcM.png)
- [jdbs slide what is does](https://i.imgur.com/NAr95En.png)
- [jdb issues](https://i.imgur.com/WR7qUae.png)
- [alternatives](https://i.imgur.com/rYhiX8o.png)
- [jdbi](https://i.imgur.com/OcNKIfH.png)

View File

@ -8,7 +8,7 @@ tags:
- inductive approach is esential for understanding time-complexity of resursive algorithms
## 1 Proof by induction
[[Induction]]
[induction](notes/induction.md)
Find a (positive integer) _parameter_ that gets smaller in all recursive calls
Prove inductively that "for all values of the parameter, the result computed is correct"
To do that:
@ -17,7 +17,7 @@ To do that:
## 2 Examples
### 2.1 Quicksort
[[divide and conquer]] algorithm
[divide-and-conquer](notes/divide-and-conquer.md) algorithm
sorts a range in an array (a group of elements between some lower index, $lo$ inclusive and some upper index $hi$ exclusive) as follows:
- If length of range $(hi - lo)$ is at most 1 -> do nothing
- otherwise, choose a pivot p (e.g., the element at $lo$) and:
@ -109,7 +109,6 @@ $\ \ \ \ \ \ \ \ \ = C+D\times(n-1)$
$\therefore$ By induction it's true for all $n>=1$
$P(n)$ is the time for evaluating $fibPair(n)$ using this algorithm. This analysis gives:
$P(1) = C$

View File

@ -13,4 +13,5 @@ links: [[notes/cosc-201]]
- [11-sets-maps-trees](notes/11-sets-maps-trees.md)
- [12-binary-search-tree-operations](notes/12-binary-search-tree-operations.md)
- [13-bst-traversals-and-balance](notes/13-bst-traversals-and-balance.md)
- [14-balancing-bsts](notes/14-balancing-bsts.md)
- [14-balancing-bsts](notes/14-balancing-bsts.md)
- [15-dynamic-programming](notes/15-dynamic-programming.md)

View File

@ -16,4 +16,5 @@ links: [cosc-202](notes/cosc-202.md)
- [13-code-librarires](notes/13-code-librarires.md)
*
- [15-containers](notes/15-containers.md)
- [16-compilers](notes/16-compilers.md)
- [16-compilers](notes/16-compilers.md)
- [17-linkers-and-loaders](notes/17-linkers-and-loaders.md)

View File

@ -18,4 +18,5 @@ links: [[notes/info-201]]
-
- [15-from-models-to-code-and-back](notes/15-from-models-to-code-and-back.md)
- [16-reverse engineering](notes/16-reverse%20engineering.md)
- [17-data-access](notes/17-data-access.md)

View File

@ -4,7 +4,7 @@
# <% tp.date.now("DD-MM-YY") %>
<% tp.user.getAOTD() %>
<% tp.user.album() %>
## Todos