Teaching Students Java Bytecode Using Lego Mindstorms Robots
java课程设计范例

java课程设计范例一、教学目标本节课的教学目标是让学习者掌握Java编程语言的基本语法、流程控制语句以及简单的数据结构。
通过本节课的学习,学生将能够:1.理解Java语言的基本语法,包括数据类型、变量、运算符等。
2.掌握Java的流程控制语句,包括条件语句、循环语句等。
3.熟悉Java的基本数据结构,包括数组、链表、栈和队列等。
4.能够运用Java语言编写简单的程序,实现基本的算法。
二、教学内容本节课的教学内容主要包括以下几个部分:1.Java语言的基本语法:介绍Java语言的数据类型、变量、运算符等基本语法规则。
2.流程控制语句:讲解条件语句、循环语句等流程控制语句的用法和意义。
3.基本数据结构:介绍Java中的数组、链表、栈和队列等基本数据结构及其应用。
4.编程实践:通过编写简单的Java程序,使学生能够将所学知识应用于实际问题的解决中。
三、教学方法为了达到本节课的教学目标,我们将采用以下几种教学方法:1.讲授法:通过讲解Java语言的基本语法、流程控制语句和基本数据结构,使学生能够理解和掌握相关知识。
2.案例分析法:通过分析具体的Java程序案例,使学生能够了解和掌握Java语言的应用方法。
3.实验法:让学生通过编写和运行Java程序,亲自体验和掌握Java语言的语法和编程技巧。
四、教学资源为了支持本节课的教学内容和教学方法的实施,我们将准备以下教学资源:1.教材:《Java编程语言》等与本节课内容相关的教材和参考书。
2.多媒体资料:通过PPT等多媒体形式,生动、形象地展示Java语言的基本语法、流程控制语句和基本数据结构。
3.实验设备:为学生提供必要的计算机和网络环境,让他们能够编写和运行Java程序。
五、教学评估为了全面、客观地评估学生的学习成果,我们将采用以下几种评估方式:1.平时表现:通过观察学生在课堂上的参与程度、提问回答等情况,评估他们的学习态度和理解能力。
2.作业:布置与课程内容相关的作业,评估学生对知识点的掌握程度和编程能力。
java 教案

java 教案Java教案一、教案概述本教案旨在为学习Java编程语言的初学者提供一套系统、全面的学习方案。
通过本教案的学习,学生将掌握Java的基本语法、面向对象编程、异常处理、多线程编程等核心知识,为进一步深入学习Java打下坚实的基础。
二、教学目标1. 理解Java编程语言的基本概念和特点;2. 掌握Java的基本语法,包括数据类型、运算符、控制结构等;3. 熟悉面向对象编程的基本原理和方法;4. 学会使用Java进行文件操作、异常处理和多线程编程;5. 能够独立完成简单的Java程序设计任务。
三、教学内容和方法1. Java基础知识a. Java编程语言的概述和特点;b. Java开发环境的搭建和配置;c. Java程序的基本结构和执行过程;d. 数据类型、变量和常量的定义与使用;e. 运算符和表达式的使用;f. 控制结构(条件语句、循环语句)的使用。
教学方法:理论讲授结合实例演示,让学生通过编写简单的程序来巩固所学知识。
2. 面向对象编程a. 面向对象编程的基本概念和特点;b. 类和对象的定义与使用;c. 封装、继承和多态的原理和应用;d. 方法的定义和调用;e. 构造方法和析构方法的使用。
教学方法:通过案例分析和代码实践,引导学生逐步理解面向对象编程的思想和方法。
3. 文件操作a. 文件的读取和写入;b. 文件流的使用;c. 文件的复制、删除和重命名。
教学方法:通过实例演示和练习,让学生熟悉文件操作的基本过程和常用方法。
4. 异常处理a. 异常的概念和分类;b. try-catch语句的使用;c. 异常处理的原则和技巧。
教学方法:讲解异常处理的基本原理,通过实例演示和练习,让学生掌握异常处理的方法和技巧。
5. 多线程编程a. 线程的概念和特点;b. 线程的创建和启动;c. 线程的同步和通信;d. 线程的生命周期和状态。
教学方法:通过案例分析和实践操作,让学生理解多线程编程的基本概念和实现方法。
java课程设计字母打字游戏

java课程设计字母打字游戏一、教学目标本节课的教学目标是让学生掌握Java编程的基本语法和流程控制,能够使用Java编写简单的字母打字游戏。
具体来说,知识目标包括:1.理解Java的基本数据类型和变量。
2.掌握Java的运算符和表达式。
3.熟悉Java的流程控制语句,包括条件语句和循环语句。
技能目标包括:1.能够使用Java编写简单的程序,实现基本的输入输出。
2.能够使用Java的流程控制语句,实现程序的逻辑控制。
3.能够独立完成字母打字游戏的编写和调试。
情感态度价值观目标包括:1.培养学生对编程的兴趣和热情,提高学生的问题解决能力。
2.培养学生团队合作的精神,鼓励学生在课堂上积极互动和交流。
3.培养学生对编程的持续学习和探索的态度,激发学生的创新意识。
二、教学内容本节课的教学内容主要包括Java的基本语法和流程控制。
具体安排如下:1.介绍Java的基本数据类型和变量,包括整数类型、浮点类型、字符类型和布尔类型。
2.讲解Java的运算符和表达式,包括算术运算符、比较运算符、逻辑运算符和赋值运算符。
3.学习Java的流程控制语句,包括条件语句(if-else)和循环语句(for、while、do-while)。
4.通过案例分析和实践,让学生掌握条件语句和循环语句的使用,编写简单的字母打字游戏。
三、教学方法为了激发学生的学习兴趣和主动性,本节课将采用多种教学方法相结合的方式。
具体方法如下:1.讲授法:教师讲解Java的基本语法和流程控制,为学生提供系统的知识框架。
2.案例分析法:通过分析具体的字母打字游戏案例,让学生理解和掌握Java编程的方法。
3.实验法:学生动手实践,编写和调试字母打字游戏,培养学生的实际编程能力。
4.小组讨论法:学生分组合作,互相交流和讨论,培养学生的团队合作精神和问题解决能力。
四、教学资源为了支持教学内容和教学方法的实施,本节课将利用多种教学资源。
具体资源如下:1.教材:《Java编程入门》教材,为学生提供基础知识的学习材料。
java 教案

java 教案Java教案标题:Java教学计划:学习Java编程的有效方法正文:在当今数码时代,计算机编程已成为一项非常有前途和有求必应的技能。
而Java作为一种广泛使用的高级编程语言,具备强大的跨平台特性,逐渐成为新手和专业程序员的首选。
本教案旨在为初学者提供有效和系统的Java编程教学方案。
第一阶段:初识Java编程在本阶段,学生将获得Java编程的基础知识和概念。
以下是重点内容:1. 介绍Java编程语言的起源和应用领域。
2. 学习Java的开发环境设置,包括安装和配置JDK(Java Development Kit)。
3. 理解Java编程的基本语法、数据类型和运算符。
4. 编写简单的Java程序并进行调试和运行。
第二阶段:Java核心概念与编程技巧在本阶段,学生将深入学习Java的核心概念和编程技巧。
以下是重点内容:1. 对面向对象编程的理解,包括类、对象、继承、多态等概念。
2. 熟悉Java的控制结构,如条件语句、循环语句和分支语句的使用。
3. 学习Java的异常处理机制和文件操作。
4. 利用Java的类库进行常用数据结构和算法的实现。
第三阶段:Java应用开发在本阶段,学生将学习如何应用Java编程进行实际项目开发。
以下是重点内容:1. 开发图形用户界面(GUI)应用程序,利用Java Swing或JavaFX库进行界面设计和事件处理。
2. 学习网络编程,使用Java的Socket和URL类库进行网络通信。
3. 理解数据库编程,并使用Java的JDBC(Java Database Connectivity)接口进行数据库操作。
4. 实践项目:学生将完成一个基于Java的小型应用程序,整合前述所学的知识和技能。
本教案的教学方法将结合理论和实践,采用教师讲解、实例演示和学生实践编程的方式进行。
此外,课堂练习、作业和小组项目将作为评估学生掌握情况的手段。
通过完成本教案的学习,学生将掌握Java编程的基础知识和技能,并能够独立开发简单的Java应用程序。
JAVA程序设计教案

JAVA程序设计教案一、课程背景和意义:Java是一种广泛应用于企业级系统开发的编程语言,具有跨平台、面向对象等特点。
在当今信息化的时代,掌握Java编程技能已成为IT从业者的基本能力。
本课程旨在帮助学生系统学习Java编程语言的基础知识和技能,培养学生的编程思维和实际编程能力,为学生今后的职业发展打下坚实的基础。
二、教学目标:1. 理解Java编程语言的基本特征和面向对象的程序设计思想;2. 掌握Java编程语言的基本语法和常用类库;3. 能够独立进行简单的Java程序设计和问题解决;4.培养学生的编程能力和逻辑思维,提高问题分析和解决能力。
三、教学内容:1. Java编程语言概述(1)Java的特点和应用领域;(2)Java平台的特点和跨平台性;(3)Java程序的基本结构和运行原理。
2. Java语言基础(1)数据类型和变量;(2)运算符和表达式;(3)控制语句(if语句、switch语句、循环语句等);(4)数组和字符串。
3.面向对象的程序设计(1)面向对象的基本概念;(2)类和对象的定义和使用;(3)封装、继承、多态等面向对象的特性。
4. Java标准库的使用(1)Java常用类库的概况;(2)输入输出流的操作;(3)异常处理机制;(4)集合框架和泛型。
5.实践项目学生在学完以上内容后,将根据实际需求和问题,设计并实现一个小型实践项目,加深对Java编程的理解和应用。
四、教学方法:1. 讲授相结合:通过教师讲解和示范,帮助学生理解Java编程的基本知识和技能;2.练习实践:设计各种编程练习和实践项目,巩固学生的编程能力;3.互动讨论:提倡学生之间的互动和讨论,促进思维碰撞和问题解决;4.课堂展示:鼓励学生在课堂上展示自己的编程成果,学习他人的优秀编程思路。
五、教学评估方式:1.课堂表现(占比30%):包括课堂参与、作业完成情况等;2.项目成果(占比40%):学生根据实践项目的要求,完成并提交项目代码及相关文档;3. 考试成绩(占比30%):期末考试测试学生对Java编程知识的掌握情况。
java基础语法实验实验原理

java基础语法实验实验原理
Java基础语法实验原理
Java基础语法实验是一种通过编写和运行Java程序来理解和掌握Java语言基
础知识和语法规则的实践活动。
这些实验旨在帮助学习者熟悉Java编程环境以及Java程序的结构、语法和执行过程。
在进行Java基础语法实验时,首先需要安装Java开发工具包(JDK)并配置
好Java开发环境。
然后,使用任何文本编辑器编写Java源代码文件,以.java为后
缀名保存。
Java程序员使用Java编译器(javac)将源代码编译为Java字节码文件(.class文件)。
Java程序的执行依赖Java虚拟机(JVM)。
通过调用Java虚拟机内的Java解
释器(java),可以在计算机上执行Java程序。
Java虚拟机会读取并解释Java字
节码文件,将其转换为可执行的机器码。
这样,Java程序就可以在不同的操作系统上运行。
在进行Java实验时,学习者可以编写简单的程序,例如输出"Hello World"的程序。
这样的程序可以帮助学习者了解Java语法中的基本元素,如变量声明、数据
类型、运算符和控制语句等。
此外,Java实验也可以涉及更复杂的概念和功能,如面向对象编程、异常处理、文件操作和多线程等。
通过逐步增加难度和复杂度,学习者可以逐渐提高自己的Java编程技能和理解能力。
总之,Java基础语法实验通过实践操作帮助学习者掌握Java编程的基本原理和规则。
通过不断地编写和运行Java程序,学习者可以加深对Java语言的理解,并
逐步提升自己的编程能力。
Java程序设计语言教案实例

Java程序设计语言教案实例第一章:Java简介1.1 课程目标了解Java语言的历史和发展理解Java语言的特点和应用场景掌握Java程序的基本结构1.2 教学内容Java语言的起源和发展Java语言的特点:面向对象、跨平台、简单、安全等Java程序的基本结构:类、方法和主函数Java开发环境和运行机制1.3 教学方法讲授法:讲解Java语言的历史、特点和应用场景示例法:演示Java程序的基本结构实践法:学生动手编写简单的Java程序1.4 教学评价课堂问答:了解学生对Java语言的认知程度课后作业:检查学生对Java程序结构的掌握情况第二章:Java基本语法2.1 课程目标掌握Java语言的基本语法规则学会使用Java语言编写简单的控制结构Java语言的基本语法规则:变量、数据类型、运算符等控制结构:条件语句、循环语句常用Java库函数2.3 教学方法讲授法:讲解Java语言的基本语法规则示例法:演示如何使用Java语言编写控制结构实践法:学生动手编写含有控制结构的Java程序2.4 教学评价课堂问答:检查学生对Java基本语法的理解程度课后作业:评估学生对Java控制结构的掌握情况第三章:面向对象编程3.1 课程目标理解面向对象编程的基本概念学会使用Java语言实现面向对象编程3.2 教学内容面向对象编程的基本概念:类、对象、封装、继承、多态Java语言实现面向对象编程:定义类、创建对象、调用方法等3.3 教学方法讲授法:讲解面向对象编程的基本概念示例法:演示如何使用Java语言实现面向对象编程实践法:学生动手编写面向对象的Java程序课堂问答:了解学生对面向对象编程概念的理解程度课后作业:评估学生对Java面向对象编程的掌握情况第四章:Java数组和字符串4.1 课程目标掌握Java语言中的数组和字符串处理4.2 教学内容数组:创建数组、遍历数组、数组的排序和查找等字符串:字符串的创建、字符串的长度、字符串的连接和切割等4.3 教学方法讲授法:讲解数组和字符串的基本概念和用法示例法:演示如何使用数组和字符串处理数据实践法:学生动手编写使用数组和字符串的Java程序4.4 教学评价课堂问答:检查学生对数组和字符串概念的掌握程度课后作业:评估学生对Java数组和字符串处理的熟练程度第五章:Java异常处理5.1 课程目标理解Java异常处理的基本机制学会使用Java的异常处理机制编写健壮的程序5.2 教学内容异常处理的基本概念:异常、异常类型、异常链Java异常处理机制:try-catch-finally语句、抛出自定义异常异常处理的最佳实践5.3 教学方法讲授法:讲解异常处理的基本概念和机制示例法:演示如何使用try-catch-finally语句处理异常实践法:学生动手编写包含异常处理的Java程序5.4 教学评价课堂问答:了解学生对异常处理概念的理解程度课后作业:评估学生对Java异常处理的掌握情况第六章:Java集合框架6.1 课程目标掌握Java集合框架的基本概念和常用集合类学会使用Java集合类进行数据存储和操作6.2 教学内容集合框架的基本概念:集合、列表、集、映射等Java集合类:ArrayList、LinkedList、HashSet、TreeSet、HashMap、TreeMap 等集合类的使用场景和性能特点6.3 教学方法讲授法:讲解集合框架的基本概念和常用集合类示例法:演示如何使用Java集合类进行数据操作实践法:学生动手编写使用集合类的Java程序6.4 教学评价课堂问答:了解学生对集合框架概念的理解程度课后作业:评估学生对Java集合类使用的掌握情况第七章:Java输入输出流7.1 课程目标理解Java输入输出流的概念和作用学会使用Java的输入输出流进行文件操作7.2 教学内容输入输出流的概念:输入流、输出流、文件流Java I/O类库:File类、InputStream类、OutputStream类、Reader类、Writer类文件的读取和写入:文件的打开、读取、关闭等操作7.3 教学方法讲授法:讲解输入输出流的概念和类库示例法:演示如何使用Java I/O类库进行文件操作实践法:学生动手编写进行文件读写的Java程序7.4 教学评价课堂问答:了解学生对输入输出流概念的理解程度课后作业:评估学生对Java I/O类库使用的掌握情况第八章:Java多线程编程8.1 课程目标理解Java多线程编程的基本概念和机制学会使用Java的线程类和并发工具进行多线程编程8.2 教学内容多线程编程的基本概念:线程、线程池、同步、并发Java线程类:Thread类、Runnable接口线程同步:synchronized关键字、volatile关键字并发工具:CountDownLatch、CyclicBarrier、Semaphore等8.3 教学方法讲授法:讲解多线程编程的基本概念和机制示例法:演示如何使用Java线程类和并发工具进行多线程编程实践法:学生动手编写多线程程序8.4 教学评价课堂问答:了解学生对多线程编程概念的理解程度课后作业:评估学生对Java线程同步和并发工具的掌握情况第九章:Java网络编程9.1 课程目标理解Java网络编程的基本概念和机制学会使用Java的Socket类进行网络通信9.2 教学内容网络编程的基本概念:网络协议、IP地址、端口、套接字Java Socket类:Socket类、ServerSocket类、InetAddress类网络通信的实现:客户端与服务器端的连接、数据传输9.3 教学方法讲授法:讲解网络编程的基本概念和机制示例法:演示如何使用Java Socket类进行网络通信实践法:学生动手编写网络通信程序9.4 教学评价课堂问答:了解学生对网络编程概念的理解程度课后作业:评估学生对Java Socket类网络通信的掌握情况第十章:Java项目实践10.1 课程目标培养学生独立完成Java项目的能力学会使用版本控制系统进行项目管理和协作开发10.2 教学内容项目实践:根据实际需求设计并实现一个Java项目版本控制系统:Git的安装和使用、项目的分支管理、代码的合并和冲突解决10.3 教学方法指导法:对学生进行项目实践的指导和答疑协作法:学生分组进行项目开发,培养团队合作能力实践法:学生动手完成项目并进行版本控制10.4 教学评价项目评审:评估学生项目完成的质量和完整性团队评价:了解学生在项目中的合作和贡献程度重点和难点解析一、Java语言的特点和应用场景解析:理解Java语言的特点是学习Java的基础,这对于学生后续掌握Java编程至关重要。
Java面向对象程序设计教案

Java面向对象程序设计教案一、课程简介1.1 课程背景Java是一种广泛应用于企业级开发、移动应用、Web开发等领域的面向对象编程语言。
通过学习Java面向对象程序设计,学生可以掌握Java基本语法、面向对象编程思想及常用API,为以后从事软件开发工作打下坚实基础。
1.2 课程目标(1)理解Java编程语言的基本语法;(2)掌握面向对象编程的核心概念,如封装、继承、多态;(3)熟悉常用Java类库及API;(4)能够独立编写简单的Java应用程序。
二、教学内容2.1 Java基本语法(1)变量、数据类型与运算符;(2)控制结构(条件语句、循环语句);(3)数组与字符串;(4)方法与对象。
2.2 面向对象编程思想(1)类与对象;(2)构造方法与this关键字;(3)封装与访问权限;(4)继承与多态。
2.3 常用Java类库及API(1)ng包(String类、Math类等);(2)java.util包(集合类、日期时间类等);(3)java.io包(文件操作类等);(4)Java网络编程。
三、教学方法3.1 授课方式采用讲授、案例分析、上机实践相结合的方式进行教学。
3.2 实践环节安排课后练习及实验课程,巩固所学知识,提高实际编程能力。
3.3 互动交流鼓励学生在课堂上提问、分享学习心得,教师及时解答学生疑问。
四、评价方式4.1 平时成绩(1)课后练习:30%;(2)实验课程:40%;(3)课堂表现:30%。
4.2 期末考试(1)理论知识:40%;(2)编程实践:60%。
五、教学计划5.1 课时安排共计64课时,其中理论授课48课时,实验课程16课时。
5.2 教学进度(1)第1-8周:Java基本语法;(2)第9-16周:面向对象编程思想;(3)第17-24周:常用Java类库及API;(4)第25-28周:综合实战及复习。
六、常用Java类库及API(续)6.1 图形用户界面(GUI)编程Swing组件库的使用事件处理机制布局管理器6.2 数据库连接与操作JDBC的概念与使用SQL语句的编写数据库连接池技术6.3 JavaFX编程JavaFX基础组件场景图(Scene Graph)媒体与动画六、教学方法6.1 授课方式通过实例讲解和动手实践,让学生掌握GUI编程和数据库操作的技巧。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Teaching Students Java Bytecode Using Lego Mindstorms RobotsMichael J Jipping Department of Computer ScienceHope CollegeHolland, MI 49423jipping@Cameron Calka Department of Computer ScienceHope CollegeHolland, MI 49423 cameron.calka@Brian O’NeillDepartment of Mathematics and Computer ScienceSaint Joseph’s UniversityPhiladelphia, PA 19131brian.oneill2@Christopher R. Padilla Department of Computer Science University of HartfordWest Hartford, CT 06117padilla@ABSTRACTAssembly language is a valuable subject to teach, yet one of the most underappreciated by students. Students do not see the need for assembly language and they get through it as quickly as possible. Given the time in a computer organization course to teach assembly language, assignments – either quick-and-easy ones or those contrived-to-teach-a-point – contribute to this attitude of malaise. This paper documents a project to inject some fun into the teaching of assembly language. First, we switch the language to Java bytecode. Second, we use unique assignments to use Java bytecode with Lego Mindstorms robotics.Categories and Subject DescriptorsK.3 [Computers & Education]: Computer and Information Science Education – Computer Science Education.General TermsExperimentation, Design, Human FactorsKeywordsAssembly langauge, computer organization, robotics, Lego Mindstorms1 INTRODUCTIONIn the computer science curriculum, the Computer Organization course stands out because of the time frame in which it is taught and the sheer variety of topics which must covered. The course is introductory by nature and needs to be approachable by most first-year students. It combines discrete mathematics with hardware design and assembly language programming. It requires that new and difficult subject matter be delivered to the student through hands-on experimentation-based activities. Active learning and experimentation in a Computer Organization course can be difficult because of the variety of material in the course and the speed with which it is delivered. In addition, the course focuses on aspects of computer science that are not covered in many other places. For example, there are not many other classes that cover assembly language programming…or use it, for that matter.Assembly language programming can become a part of the Computer Organization course that is simply tolerated. There is rarely enough time to teach a complete assembly language programming section (much less a class) and assignments can be designed to give students an overview only – ones that involve either quick, survey-oriented assignments or those contrived to point out specific aspects of assembly language. In an experimentation-based course, assembly language can be dry and experience-free task.This paper documents an approach that we have designed to tackle these issues in teaching assembly language programming. We choose to teach Java bytecode, for reasons we will spell out, and we teach Java bytecode using Lego Mindstorms robotics kits. We begin by giving the motivation for choosing bytecode. We then describe the system used to get Lego robots to obey Java programming. We conclude the paper by describing our system of assignments that get students working.SS2 BACKGROUND AND MOTIVATIONThe Computer Organization course is often a course withseveral separate components. The course is meant to allowstudents to apply discrete mathematics concepts to digital logicdesign, to briefly explore computer architecture, and to dabble in assembly language programming, often as a way to exemplify the circuit and architecture material. Along the way, students are asked to experiment in all of these areas. It is a fast-paced course with little time to spend learning development systems. Time constraints make the teaching of assembly language, which is an important part of the Computer Organization course, quite difficult. It is, in fact, a complete programming language in itself and teaching a programming language – one might devote an entire course to doing this – in a brief section of a larger course is not easy. Making assignments in this context is very challenging: it is difficult to assign anything more than simple assignments contrived to demonstrate specific points.The importance of assembly language is in two areas. First, it is a language that supports other languages and, in this role, it helps in the understanding of higher-level programming. The complexities of algorithms and data structures stand out when you see them in an assembly language. Second, assembly language directly addresses the machine architecture on which it executes and, in this role, it helps understanding and appreciation of that architecture. There are many “head knowledge” concepts that just do not hit home until you have to program using them. The necessity of indirect addressing with a load/store RISC architecture suddenly makes sense when you must load variables from memory in a SPARC architecture assembly language program.Our Computer Organization course has faced all the issues discussed above: tight time constraints, the need to fit a lot of subject matter into this one course, and treatment of topics as introductions. In addition, we recognized the value of assembly language programming, but taught our assembly language section with contrived examples, designed to show off language features but divorced from a student’s experience with programming. We wanted to reemphasize the importance of assembly language programming by playing to a student’s frame of reference and by placing programming in a context where a student might enjoy programming (and even get inspired).We started by changing the language taught from SPARC assembler to Java bytecode. We did this for several reasons. First, our students’ experiences are more likely to include Java and the Java virtual machine than C++ on a Windows or Unix system. One of the ways we use to illustrate assembly language is to describe programs in the context of higher level languages. Students have programmed in Java by the time they take this course and examples in Java make more sense to them A second reason we changed assembly languages is the opportunity to discuss “interesting” machine architectures. Java bytecode allows us to discuss the architecture of the Java Virtual Machine (JVM). This discussion allows us to apply many architecture design issues in a new way. Issues involving stack-based architectures, instruction set design, and machine performance can be applied to the Java Virtual Machine. Third, the tools available – from disassemblers to profiling tools – are more plentiful with Java and they are free. Finally, we chose Java bytecode because the programs we can write are more interesting. For example, we could not have applied SPARC assembly language to Lego Mindstorms. Java bytecode is known as the assembly language in Java. It is used as a middle ground between the Java programming language and the Java Virtual Machine. Bytecode in Java plays the same role as assembly language for hardware CPUS, yet there some important differences. It has no mnemonic definition; the official specification for bytecode describes each instruction and its effect on the JVM, but does not give mnemonics. This means that, while official compilers exist that generate bytecode, there is not official assembler.In fact, there are many different Java bytecode assemblers available due to this lack of an official assembler. For our research we opted to use the Jasmin assembler [3]. Jasmin was originally written as a companion tool to the book Java Virtual Machine[2] and is now a SourceForge open source project. Jasmin is similar to other assemblers. The classes are first written in Jasmin and then are converted to binary Java class files which can then be loaded and executed by any Java runtime system.The use of Jasmin has several advantages. As noted, it is an open source project, protected by the GNU Public License. It is free and is itself written in Java. This means it is usable on many platforms (we have used it on Solaris, Linux, and Microsoft Windows). In addition, the Jasmin input source looks extremely close to Java bytecode, which means a student can study and understand one format of assembly code.3 JAVA BYTECODE AND MINDSTORMS For our research we chose to use the Lego Mindstorms Robotics Invention System (RIS) 2.01. This kit includes 718 Lego pieces, one Infrared USB Tower, one RCX brick, one light sensor, and two touch sensors. The Infrared USB Tower is connected to the PC and is used to transmit data, such as the firmware and programs, to the Lego Mindstorms RCX brick. The RCX, Robotic Command eXplorer, brick is the main component of the Lego Mindstorms kit. Measuring at approximately 6 cm x 10 cm x4 cm, the RCX brick is a very small and powerful device. There is a Central Processing Unit, CPU, inside of the RCX which is a Hitachi H8/3292 series microcontroller. The CPU operates at 16 MHz which is more then enough processing power to operate the sensors and motors that can be attached to the brick. The RCX also controls 32 kB of external RAM which is used to store both the firmware and the user’s programs. In order to communicate and upload the firmware and user programs, the RCX contains an Infrared device that is located in the front of the device. A light sensor can be used to read the values of different light input and allow the robot to react accordingly. A touch sensor allows the robot to react to three different tactile states. These include whether the touch sensor is currently pushed, is currently not pushed and has been pushed and released.1At the time of this writing, the next version of Mindstorms, known as NXT, is due anytime. We still are going with the older RIS system because (a) it is readily available (while NXT is not), and (b) the Java Virtual Machine system we tested is available and works well on the older system.The use of Java bytecode with Lego Mindsorms requires loading a different firmware onto the RCX brick. We chose to use the Java environment known as leJOS which is directly compatible with RIS system. LeJOS is a system that includes JVM firmware for the Lego Mindstorms and tools to convert and upload Java class files to the RCX brick. It was originally developed from another Lego Mindstorm firmware available known as TinyVM. This SourceForge project [4] was developed in 1999 and eventually matured to what is known as leJOS today. Normally, leJOS works with Java files and converts the Java files to class files and uploads the files to the RCX brick. Instead of having leJOS convert java files to class files, however, we take Jasmin files, convert them to class files with Jasim, and upload these files to the RCX brick via leJOS. In order to speed this process up we created a batch file which will take all the Jasmin (.j) files in a folder and convert them to class files using Jasmin. Once this is complete, the batch file will upload the class files to the RCX brick via leJOS. This batch file assumes that all the Jasmin files compile correctly.In order to limit the amount of mistakes made by the student we also created a defined language plug-in for a text editor (Notepad++ [1]), allowing the students to get a visualization of the different components inside of a Jasmin file. This defined language splits Jasmin keywords into color groups and displays them accordingly. Using this plug-in allows the student to view the code as if they were writing the code in an IDE. While Notepad++ lacks error detections, the defined language plug-in helps to alleviate common spelling mistakes of keywords. There are other tools are useful as students design code for the leJOS environment. We found that when creating a program it proves to be beneficial for the programmer first create the program in a familiar language, such as Java, and then continue to program in Jasmin. Doing so will allow the programmer a better understanding of what they are attempting to program in a Jasmin. We chose to use the Eclipse IDE as our programming environment when coding in Java. This allowed us to use a leJOS plug in that is available that allows the user to compile and upload java files through Eclipse rather then using command prompt. This helped to speed up the process of our preliminary steps of programming in Jasmin.4 ASSIGNMENTSIn our choice of leJOS, we have a robotic control system that was programmable in Java. This choice is supported by development tools. We next needed a set of class assignments that would illustrate Java bytecode, but not in a contrived way. Our assignments are designed to have the students write and code an algorithm for a maze-solving robot. To achieve this, we designed our own algorithms, maze, class structure, and assignments using leJOS and Jasmin. The students will start with our class structure and files. Over three assignments, the students will replace our code with their own to introduce the design of their robots and algorithms. After each assignment, the students will download the code to the robot and place it into the maze. 4.1 Design of the MazeThe floor of the maze is made of foam posterboard, while the walls are built out of Duplos, the Lego blocks intended for preschool-aged children. We chose these blocks because of their size and low price. The walls are approximately 6 Duplos high and 1 Duplo thick. The maze is built on a grid design, with each grid square having a length 14 Duplo pegs. Our example maze is a 4x4 grid, however any grid alignment should work; it need not be rectangular. In order to stabilize the maze, we used a “bridge” made of Duplos to connect separate wall sections. This prevents the robots from bending the maze by pushing against the wall. Because of the height of the bridge, the robots may not be any taller than the walls.The red line running down the center of each alley is made from electrical tape. At the intersections in the maze, the red tape is overlaid with a black rectangle, also made from electrical tape. Students can use light sensors to follow the line, using the black sections to know that a decision needs to be made.The maze was designed so that the start and finish are both along the outside wall. The start is closed off, so that there is no chance of the robot exiting the maze through the entrance. If a robot somehow returned to the start, it would only notice a dead-end.This type of maze design allows several different solutions. We provide two of them, but there are others. One possible solution uses a light sensor programmed to act as a proximity sensor. It navigates the maze by following the red line with one light sensor, and using the converted light sensor to avoid oncoming walls. Another design follows the walls in the maze using a light sensor pointed to the side and a touch sensor in front.4.2 Context of the AssignmentsBy the time the students are given the first assignment, it is expected that they will already have received some instruction in Java bytecode. We will give the students a guide to bytecode and Jasmin formatting. They will also get a summary of important functions from the leJOS API, and tips for debugging and running their programs. In addition, the students will see a “HelloWorld” program on the RCX performed and be given the code in Java and bytecode. This will give them some points of reference as they try to write their own bytecode. These experiences are done through in-class lab experiments.Prior to considering their own algorithms for their robot, the students will see two successful designs in action. The first algorithm, the BumpBot, uses a touch sensor to follow the right-hand wall until it reaches the exit. The second algorithm, the Line Follower, uses a red line down the center of each alley to make its way through the maze. A black box denotes an intersection in the maze where the robot must make a decision about which way to go. In this case, the algorithm tells the robot to turn right. If the robot hits a wall, it turns around.Figure 1: An example maze designStudents receive copies of our class files. To pilot the robot through the maze, they will package what code they have written with any code they need of ours. However, to dissuade students from using a decompiler to write their bytecode, the class files we give them will have been run through an obfuscator to scramble our code.4.3 AssignmentsUsing the class structure shown in Figure 2, the students will replace our class files with their own over three separate assignments.In the first assignment, students will remove and replace the TouchSensor and LightSensor classes. Students will be responsible for both classes regardless of whether they plan to use each type of sensor. In the assignment description, we will delineate any methods that are necessary for this class to work with the other classes. Students will also be encouraged to add any methods that they feel will be necessary for algorithms they may be considering. The students will be given approximately 2-3 days to complete the assignment. The robot will be placed in the maze to test the LightSensor and TouchSensor code.For the LightSensor class, we expect the following functions: •void activate()•void addSensorListener(SensorListener)•boolean betweenValues(int, int)•int getID()•int getValue()•boolean isDark()•boolean isLight()•void off()Each of these functions are described in the BULB API, which will be provided to students.For the TouchSensor class, we expect a similar list of functions: •void activate()•void addSensorListener(SensorListener)•int getID()•boolean isPressed()•void off()For the second assignment, students will replace our Motors class with their own. The Motors class governs the movement of the robot. As with the previous assignment, the students will be told what methods are necessary for the robot to behave properly. Again, the students will be encouraged to add other methods to work with their own designs. The students will be given one week to complete this assignment. Upon completion, the robot will be tested in the maze.As with the sensor classes, we expect certain methods to be present in student versions of the Motors class:•void brake()•void coast()•void forward()•void forward(long)•void fwdDist(int)•void spin(float)•void spinLeft(double)•void spinRight(double)•void turnLeft()•void turnLeft(long)•void turnRight()•void turnRight(long)For the final assignment, the students will replace the MazeSolver class that governs the actions of the robot. This class interacts with the Behavior interface, which is part of the leJOS API, and can be used with an Arbitrator object to prioritize the different actions of a robot. This is where the design of the maze-solving algorithms will become evident. Students may either attempt to duplicate the behaviors they saw in the example robots, or create their own with a new algorithm. Alternately, if the students want to keep working with one of the provided designs rather than trying to implement their own, they simply need to replace the MazeSolver class. The students will have a week and a half to work on this assignment, although it is expected that they have been considering their algorithms throughout the unit. As with each assignment, the students will place their robot in the maze to test its performance.5 ConclusionThis paper has presented the reasons and mechanics behind using Java bytecode and Lego Mindstorms Robots to teach assembly language in the Computer Organization course. We described why we chose Java bytecode over other assembly languages. We described the methods behind putting Java bytecode on Mindstorms Robots. We also created assignments for how it would be possible to use Lego Mindstorms and Java bytecode in a classroom environment. These assignments will be used in classes at Hope College.At this point, two additional items have been created to help students with Java bytecode. Future expansions upon this may include a plug-in for the popular Eclipse IDE, which would allow students to upload files directly from the IDE onto the Mindstorms RCX. The ability to add syntax checking for Java bytecode would also encourage more use of Java bytecode and these assignments.Finaly, it should be noted that gathering data on how students perceived this type of learning is necessary. We also have to compare this with conventional approaches to teaching to verify our initial claims that this is a better way to teach the course. AcknowledgementThe work described in this paper was performed under a CCLI program award from the National Science Foundation, award number DUE-0310757.References[1] Ho, D, et. al. “About NotePad++”, available online at[2] Meyer, J. & Downing, T. Java Virtual Machine, O’ReillyAssociates, 1997.[3] Meyer, J. and Reynauld, D., “Jasmin Home page”,available online at [4] Solorzano, J. H., “TinyVM”, available online at。