DTE Term 2 - Coding Flashcards

(29 cards)

1
Q

What is debugging?

A
  • It requires persistence and resilience
    • Debugging is figuring out why an error in a code is incorrect, and fixing it
    • Codes rarely work the first time
    • Debugging is part of the problem-solving process of programming
    • It’s very common to go through several cycles of run-test-debug to get a code right
    • Debugging is the nature of business
    • Making a habit of running your code, checking your code, and making changes as needed are important
    • It is a continuous cycle of writing, testing, and improving code
    • It is a skill and an art
    • With practice you learn how to write relatively bug-free code and more importantly you learn about yourself and the kind of errors you typically make
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are Syntax Errors?

A
  • They are things you misspelled or wrote in such a way the computer doesn’t understand what you’re trying to say
    • App Lab provides an error message of some kind that is a clue about what it can’t understand
    • Carefully read the error message to determine what has gone wrong
    • They are usually the easiest to find
      Debug Console informs coders of any typos
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are Logic Errors?

A
  • The program runs but doesn’t do what you think it should
    • They can be tricky to fix because there might not be an error message
    • You can fix these by retracing your steps, being humble, and trying to understand why the computer is interpreting what you wrote the way it is
    • The program runs but doesn’t do what you think it should
    • It may run without any error notification
    • You may initially think all is good, however, closer inspection shows it didn’t do what was expected
    • Debug console doesn’t provide any help (because it is not a syntax issue)
    • Investigate the code and make a prediction - what should happen?
    • Observe the program as it runs to see what’s going on
    • Reflect upon what is going on
    • Fix it - make it work as intended
      Repeat as necessary, until the program is correct
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the screen dimensions in App Lab?

A
  • The screen is 320 pixels wide
    • It is 450 pixels long
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the screen coordinates in App Lab?

A
  • X is the horizontal axis
    • Y is the vertical axis
    • (0, 0) is the top left corner
    • (320, 0) is the top right corner
    • (0, 450) is the bottom left corner
    • (320, 450) is the bottom right corner
    • The setPosition () command lets you move to any position on the screen and optionally set the size at the same time
    • The little arrows of the setPosition() command mean that some of the parameters are optional
    • You can click the arrows or expand the available parameters
      You can hover over the screen to see the (x, y) coordinates of any point
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are random numbers in App Lab?

A
  • App Lab has a block in the Math toolbox called randomNumber (0, 0)
    • The block will create a random number in the range provided
    • E.g. randomNumber (1, 215) this block would generate a random number between 1 (minimum) and 215 (maximum)
    • You can put in a negative number e.g. randomNumber (-10, 10)
    • It will also work if you reverse the max numbers
    • E.g. randomNumber (10, -10)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are different mouse events?

A
  • We know what happens when we use the mouse or keypad to click on a button
    • Lesson 2 introduced different mouse vents
    • When the mouse is rolled over the button, when the mouse moves within the boundary of a button or when the mouse button is pressed or released
    • Click = Event is triggered when the button is clicked
    • Mouseup = Event is triggered when the cursor button is released
    • Mousedown = Event is triggered when the cursor button is pressed and held
    • Mouseover = Event is triggered when the cursor is moved inside the button
    • Mousemove = Event is triggered when the cursor is moved onto the button
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the three different ways to add images in App Lab?

A
  • From the Web
    * Note that you cannot use the URL of an Google image search
    * You have to right+click to the image (not the thumbnail) and select “Copy Image Address”
    * Note that only .png image transparent background
    • From your OneDrive
      • You have to save images found on the web into your OneDrive≻2025≻DTE folder
      • App Lab can only use .jpg, .png, or .gif files
    • From the icon library
      • Search the icon library or a wide range of icons
        You can change the dimensions the colour of icons
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is some useful terminology from Lesson 2 in App Lab?

A
  • Error - when the program does not perform as expected
    • Syntax Error - an error that prevents the program running, usually associated with spelling issue or order of elements
    • Logic Error - an error discovered when a program runs but does not produce the desired result
    • Debugging - the process of Predict≻Observe≻Reflect as a process to remove issues that prevent the app from running as expected
    • Random number - a number that is between a minimum and mum range (that you specify)
    • Transparency - we are able to ‘see through’ images with a transparent background to see what is ‘behind it’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are some abbreviations that are used for naming widgets?

A
  • Lbl = label
    • Btn = button
    • Scr = screen
    • Snd = sound
    • Rb = radio button
    • Img = image
  • CKbx = checkbox
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is App Lab?

A
  • App Lab is a programming tool to design and develop simple mobile applications
    • Has Design
      Has Code components
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is interactivity?

A
  • It is about creating widgets such as buttons that have the vents listeners and event handlers
    • Event Listeners are waiting for ‘events to happen’
      Event Handlers is the code that runs when an event occurs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are some design principles?

A
  • Contrast
    • Alignment
    • Repetition
    • Proximity
    • Colour theory
  • Type theory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is some key information about widget names?

A
  • They must be named meaningful way
    • ID property is used to set the name a widget
    • A widget name should describe the widget in some way
    • App Lab does not force certain naming conventions, in your own project developments you are to ensure you prefix your get names with the widget type
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the 3 naming conventions for widgets?

A
  • camelCase
    * btnMoveBee
    * imgCloudySky
    * lblUserName
    • kebab-case
      • btn-move-bee
      • img-cloudy-sky
      • lbl-user-name
    • snake_case
      • btn_move_bee
      • img_cloudy_sky
        lbl_user_name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is some key vocabulary from Lesson 3?

A
  • User Interface/UI - The visual elements of a program through which a user controls or communicates with the application
    • UI Elements/Widgets - on-screen widgets, like buttons, images, text boxes, pull down menus, screens, etc
    • Event-driven program - a program designed to run blocks of code or functions in response to specified events e.g. a mouse clicker
    • Event - an action that causes something to happen e.g. clicking a button
    • Event listener - a command that can be set up to trigger a function when a particular type of event occurs on a particular UI element
      Event handling/Event handler - a term used for coding tasks involved in making a program respond to events by triggering functions
17
Q

How do you use the control log in App Lab?

A
  • The console area is where we receive error message
  • The console area can also be used to determine:
    • The order in which things are happening
    • Show the value of a variable or state of something at various points in the program during execution
      Whether an event is firing (working) or not, and when
  • E.g. a btnCalculate button needs to initiate one event when clicked and another when the mouse is over the button
    Before determining the required Callback Function, you might want to create a console log message that displays the correct message depending upon the action
18
Q

What is the order in which things appear in the control log?

A
  • Something for you to remember, is that slightly unexpected events occur when widgets that overlap on the screen are clicked:
  • When you click on a location where two objects are overlapping, which event(s) fire(s)?
    • The event-handler for object that is on top gets triggered
    • The object that is underneath is blocked from being clicked in the overlapping portion
  • When you click on a non-overlapping part of some object what gets triggered?
    • The event-handler for the object gets triggered as you might expect
  • When does a “click” on the “screen” get triggered?
    • Always
    • Events that occur on the screen cannot be blocked by other objects
    • If you set up an event listener for the screen it will capture EVERY event of that type, no matter what other UI elements are on the screen
      This behavior of the screen is done on purpose and is useful for certain kinds of things
19
Q

How do you code multiple screens?

A
  • You know that a screen is just another UI element
  • In design mode, you can only see one screen at a time
  • In code mode you can program all screens
    However, only one code space is available
20
Q

What are some screen properties in App Lab?

A

Look in OneNote for diagram.

21
Q

What are learning properties in App Lab.

A

Look in OneNote for diagram.

22
Q

What is the definition of a variable?

A
  • A variable is a named placeholder in memory that stores and can be changed
  • The information that can be stored in a variable consists of:
    • A number (1, 345, 3.14, etc)
    • A single character (a, b, A, B, etc)
    • A symbol (@, #, $, etc)
    • A word or string of characters (Hello, My name is Sally, The sun shone brightly, etc)
    • fullName (Sally Smith, Tom Jones, etc)
    • Email (someone@someplace.com.au etc)
    • Password
23
Q

What are some things learned in Lesson 5 of App Lab?

A
  • Var - use the keyword var only when you create a variable
    • E.g. var age;
    • var year = 2020;
  • Variable re-assignment - we can change the value of a variable based on its current contents
    • E.g. age = age + 1;
    • var year = year + 1;
  • setText is used to set the text property of a widget to a different value
    • E.g. setText (“Title”, “Welcome”)
  • What was learnt in Lesson 5?
    • Coding onEvents in text
    • Setting the text in a label to be something else when an event occurs
    • Consolidation of creating variables and variable re-assignment
    • Debugging issues with setting text and variable re-assignment
24
Q

What does setText do?

A
  • It sets the text for the specified element
  • Any element (widget) that had a text property can be altered with the setText command e.g. labels, buttons, text area, text input boxes, etc
25
What was learned in Lesson 6 of App Lab?
* A new datatype; Booleans * So far we have focused on: * Event driven programming where code is executed if an event occurs * Sequence programming contrdut here lines of code are executed one after the other in the order they appear (Line 1, Line 2….Line n) Lesson 6 introduced the selection programming construct where we make decisions using the IF or IF ELSE blocks
26
What are booleans?
* Variable types include: * The value of a string variable can be a character, number, or symbol * E.g. name, address, phoneNumber * The value of a number variable is a whole or decimal number * The value of a boolean can only be wither TRUE or FALSE (it cannot be both) * They are commonly used as conditions which are evaluated in IF or IF ELSE statements
27
What are IF statements?
* IF statements ask questions - they are called SELECTION programming constructs because the questions provide a selection of actions to take depending upon the 'answer' * The questions are in the form of a boolean condition in that they are either TRUE or FALSE, not both * If the boolean condition is evaluated to be TRUE, then the statements within the IF blocks are executed If the boolean condition is evaluated to be FALSE then the statements within the IF blocks are ignored
28
What are the symbols for IF statements?
Look in OneNote for diagram.
29
What is a summary of Lesson 6 from App Lab?
* Boolean expression/condition - an expression or condition that can be evaluated in an IF or IF SELSE statement as either TRUE or FALSE - it cannot be both * Selection - a programming construct that provides an alternate pathway or flow * IF statement - if the condition if evaluated as TRUE then execute the embedded code, and if FALSE, the code is ignored * Equal - a value assigned to a variable * E.g. age = 12 * Equality - the value in a variable is compared to another value to see if they are equal * These form part of a Boolean expression E.g. lives == 0