Using Visual Logic To Teach A First Course In Programming Logic Jorge Vallejos – Assistant Professor (jvallejo@cscc.edu) Computer Science Department Columbus State Community College Ohio Educational Technology Conference - January 2014
Logic – AND Benefits to our students What Is Logic ? – Loose Definitions : The application of principles of correct reasoning Proper thinking about the understanding of something Interrelation of facts and events to reach valid conclusions Why Is Logic Necessary?: Solve complex tasks by applying systematic reasoning Establish an approach to analyze and understand a problem Discover simple and efficient solutions to implement processes and systems What Do Students Gain By Learning Logic?: Develop skills for critical thinking Gather relevant facts, analyze them, and derive conclusions to troubleshoot systems Apply problem solving strategies – formalize theories, discard invalid assumptions, establish priorities (ordering of actions and validation), solve problem in incremental steps, isolate/reproduce issues, test solutions Readiness for programming courses and other analytical courses Ohio Educational Technology Conference - January 2014
courses THAT support PROGRAMMING logic MATH courses – beyond the algorithms and formulas, MATH creates the foundation to discover relations between entities, combine building blocks to compose new entities, build sets of detailed instructions to complete a task READING /WRITING courses focused on comprehension – analyze complex materials, apply critical analysis to reach conclusions, inductions and deductions PHYLOSOPHY courses: cover topics like: critical thinking, methods of inductive, deductive and symbolic logic. Ohio Educational Technology Conference - January 2014
Tools for a First course in programming logic Visual Logic Creates visual representation of algorithms in flowchart format. The program does not use formal programming-language instructions – like Java, C#, or other programming languages Alice/Alice3 – by Carnegie-Mellon Creates 3D animations. Tool is oriented towards learning computer programming. Drag objects from a palette onto a scene canvas. Objects are constructed from Java classes. Methods are presented as menus – to control the actions performed by objects Scratch – by MIT Create animated objects. The program uses a list of instructions to control the actions performed by objects Others – search the Internet Ohio Educational Technology Conference - January 2014
Visual logic Features Variables: non-typed numeric and string constants There is no variable declaration – variables are created at the point of use Constructs: Assignments Operators Arithmetic (+, -, *, /, Mod, ^), Comparison (<, >, …), Compound (AND, OR, …) Sequences Conditions: if-then-else Loops while, do-while, for – control of execution can be modified by the exit, continue clauses Arrays Procedures (a.k.a., modules): named set of instructions. Parameters: passed by value, passed by reference Do not return a value Ohio Educational Technology Conference - January 2014
Visual logic Features - Continued Functions FormatCurrency(), FormatPercent(), Round(), Random(), … There is no Wait()/Sleep()-equivalent function. Alternative: use a busy-do- nothing loop Input/Output Dialog boxes, Console, File Enforces Structured Programming – There is no GOTO instruction All programming structures have a single entry/exit point It is not possible to create spaghetti-code Ohio Educational Technology Conference - January 2014
Visual logic PITFALLS Variables are created at the point of use. When a variable identifier is misspelled, Visual Logic creates a new variable Example: Correctly spelled variable identifier: firstName. Misspelled variable identifier: fisrtName – Visual Logic creates the new variable identifier with a default zero (0) value Visual Logic does not enforce syntax – (justification: students learn logic better when focusing on the concepts – rather than syntax) It is possible to create an invalid comparison in comparison/loop statements: while (YES <> number) { … }, where YES stores the string constant “y”, and number is a numeric constant. The comparison evaluates as false – no syntax error, the loop does not execute An existing string variable can afterwards be assigned a numeric value Ohio Educational Technology Conference - January 2014
VISUAL LOGIC DEMONSTRATIONS Sequences Decisions Loops Arrays Parameterized Procedures Graphics Ohio Educational Technology Conference - January 2014
References Visual Logic http://www.visuallogic.org/ A Guide to Working with Visual Logic. Thad Crews & Chip Murphy. Course Technology – Cengage Learning. ISBN 978-0-324-60119-0 Alice http://www.alice.org/index.php Scratch http://www.scratch.mit.edu Ohio Educational Technology Conference - January 2014