dyweb / course

Dongyue Web Studio course and lecture
https://dongyueweb.com/course/
GNU General Public License v3.0
12 stars 3 forks source link

TodoList Assignment 1 Hand in #11

Closed JasonQSY closed 7 years ago

JasonQSY commented 8 years ago

Hello, I've completed the todolist assignment (assignment 1). Since I tried to make it look a bit nicer, I added default.css.

Previously, I wanted to hand in the assignment after I completed the demo. However, @at15 told me that it is unnecessary to submit it after I complete everything. It is still a shame that the server is broken and I decide to add a snapshot instead.

Repo at https://github.com/JasonQSY/TodoList

at15 commented 8 years ago

A very big problem is you store everything in session. I have provided detail reasons for why you should not do that in the commit https://github.com/JasonQSY/TodoList/commit/1d0a6c704ea427b345e84c365ee0fc9cdfc2ccd2

Since you have wrapped todo list as a class, you can change the logic for storage with affecting other code. Plain file is a good choice, you can use json or csv. ie:

{
   "user":"at15",
   "list": [{"name":"eat","status":1},{"name":"drink","status":2}]
}
at15,eat,1,drink,2
arrowrowe,东方,1,凉宫,2

Also you can refer to other guys' solution. Sometimes take a look at other peoples work is more important than try to handle everything by yourself.

Ref:

ComMouse commented 8 years ago

Have a look at the slide for solution:

  1. save and parse your own format
  2. serialize()
  3. json_encode() or xml
  4. RDBMS(We'll talk about it in later lectures)