Inputs, outputs, and debugging Flashcards
DOM
Document object model
Document.Object.Model represents (3)
Document Object Model
Document - web page - index.html
Object - pieces or individual tags/elements - H1 tag, etc.
Model - agreed upon set of terms
batch program
- a program that is designed to start from finish to end as soon as possible, and potentially produce and output
- example: anti-virus scanner
- most programs nowadays are not designed to start and finish as soon as possible. they allow you to interact with them through a graphical user interface.
persistence
saving the state of the program
what kind of persistence (saving ability) exists in javascript?
None! At least not at the basic level!
It doesn’t exist due to security concerns. But other programming languages such as java or objective C which runs natively on your OS will allow you to save files onto your hard drive.
example of a few different javascript events
1) unload
2) onclick
3) onmouseover
4) noblur
5) onfocus
what takes longer, writing code or debugging code?
debugging
errors in code (2)
1) syntax error
2) logic error
error in code
syntax error
- something is wrong with the ACTUAL format of the code
- forgot a semi colon, wrong number of braces, brackets, etc…
syntax error
- compiled vs. interpreted language
- in compiled languages, syntax errors are normally found while writing the code
- with interpreted code, you sometimes just have to run code before you know if there’s a syntax terror
error in code
*logic error
- correct in syntax but there’s a flaw in the logic
- problem with arithmetic
- infinite loop
best way to fix an error in code:
reproduce the same error
find out when the error occurs and how it occurred
trace
- finding out where the code when wrong by leaving messages in your code or functions.
trace messaging is sometimes called…
logging to the console
In object oriented programming, these “objects”….
communicate with one another
Class
The blueprint, the description, and the definition
If you wrote “classes” for a restaurant-review website, some classes would be (9)
- restaurant
- review
- user
- textbox
- button
- window
- date
- timezone
- Videoplayer
Of course, there’s more.
An attribute (english word) is akin to a . . . (computing word)
property
A behaviour (english word) is akin to . . . (computing word)
a method, a function
a property or a method?
*name
property
a property or a method?
*sleep
method
a property or a method?
*speak
method