Wednesday, May 13, 2015

5/13/15 - Notes App Javascript and More Styling

Today I started working on the javascript of the notes demo app.  One of the patterns in JavaScript: The Good Parts is to avoid using the new keyword by making constructor functions that create objects. I'm not sure if there are cases where you would want to use new over a constructor function, I'll have to keep reading the book (and re-read that section, as I'm not sure I fully understand it yet).

My new_notes_obj function returns an object that will contain the notes behavior. I'm not going to worry about decoupling this object from the display implementation (the css class names) just yet, because I'm not sure what form this app will take, and I don't want to get overly complex and beyond the scope of what's easy to teach in 6 hours. Of course, good code will probably also be easier to teach, so I'll come back to this to fix it up once I have a better idea of what the app will look like.

I will definitely keep working on the interface, especially the elements to add new notes.  There's no way to set note titles, and I'd also like for the textarea to increase in the number of rows as the user types more, so there's less scrolling involved.

I'm also running into some issues with naming css classes.  I'm not sure if it's ok to include the element type in the class name, like <textarea class="note_input_textarea"> instead of just <textarea class="note_input">

No comments:

Post a Comment