USING VISUAL LOGIC TO TEACH A FIRST COURSE IN PROGRAMMING LOGIC JORGE VALLEJOS – ASSISTANT PROFESSOR (JVALLEJO@CSCC.EDU) COMPUTER SCIENCE DEPARTMENT C O LU M B U S STAT E C O M M U N IT Y C O LLE G E 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 2 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 3 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 4 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 5 VISUAL LOGIC FEATURES - CONTINUED • Functions • FormatCurrency(), FormatPercent(), Round(), Random(), … • There is no Wait()/Sleep()-equivalent function. Alternative: use a busy-donothing 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 6 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 7 VISUAL LOGIC DEMONSTRATIONS • Sequences • Decisions • Loops • Arrays • Parameterized Procedures • Graphics OHIO EDUCATIONAL TECHNOLOGY CONFERENCE - JANUARY 2014 8 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 9