Bill MacKenty

 
 
 

You are viewing all the entries related to the category: Computer Science

Pertaining to software engineering and computer science. Mostly teaching and learning linked to these, but also general information about the field.

 

Entity-Component-System 〈ECS〉

Posted in Computer Science Teaching Diary on 02 - February 2023 at 09:07 PM (about 4 days ago) 17 views.

Different than oop? Read on...

I've learned about the Entity-Component-System (ECS)


Obligatory chatGPT / wikipedia definition: ECS is a pattern for game development that provides a way to organize and structure game logic. It is a way of designing games that separates the data (components) and behavior (systems) of entities.

In an ECS, entities are objects in the game, such as characters or enemies. Components are data structures that define the properties and attributes of an entity, such as its position, health, or sprite. Systems are responsible for updating and manipulating the components of entities.

The separation of data and behavior in an ECS allows for more flexible and modular game development, as it is easier to add or change components and systems without affecting the rest of the code. It also allows for better performance and scalability, as systems can be optimized for processing specific types of components.

Overall, the ECS pattern provides a clean and efficient way to structure game logic, making it a popular choice for game development, especially for large and complex games.

Entity Component System (ECS) is a software architectural pattern mostly used in video game development for the representation of game world objects. An ECS comprises entities composed from components of data, with systems which operate on entities' components.

ECS follows the principle of composition over inheritance, meaning that every entity is defined not by a type hierarchy, but by the components that are associated with it. Systems act globally over all entities which have the required components.


Entity: An entity represents a general-purpose object. In a game engine context, for example, every coarse game object is represented as an entity. Usually, it only consists of a unique id. Implementations typically use a plain integer for this.

Component: A component labels an entity as possessing a particular aspect, and holds the data needed to model that aspect. For example, every game object that can take damage might have a Health component associated with its entity. Implementations typically use structs, classes, or associative arrays.

System: A system is a process which acts on all entities with the desired components. For example, a physics system may query for entities having mass, velocity and position components, and iterate over the results doing physics calculations on the sets of components for each entity.

The behavior of an entity can be changed at runtime by systems that add, remove or modify components. This eliminates the ambiguity problems of deep and wide inheritance hierarchies often found in Object Oriented Programming techniques that are difficult to understand, maintain, and extend. Common ECS approaches are highly compatible with, and are often combined with, data-oriented design techniques. Data for all instances of a component are commonly stored together in physical memory, enabling efficient memory access for systems which operate over many entities.



Need a procedurally generated country?

Posted in Computer Science Teaching Diary on 29 - January 2023 at 03:46 PM (one week ago) 30 views.

Every once in a while one of my students hits the ball out of the park...

Not much sure how much better you could do than this: 

https://github.com/bmackenty/s...


Current thinking about chatGPT

Posted in Computer Science Teaching Diary on 22 - January 2023 at 07:12 AM (2 weeks ago) 54 views.

How should a high school computing teacher use chatGPT?

  1. Ensure students understand the technical boundaries
  2. Teach students to ask precise questions (with follow-up questions if necessary)
  3. Teach students to evaluate answers

  4. As teachers we should encourage students to ask all questions via a text interface (so we can capture questions) and fine-tune the model to reply. The goal is to have a "reasonably good" assistant that can support students as they work through content required by the syllabus. The input for questions should be textual / copy-paste / and spoken word. 


Writing a report card comment generator

Posted in Computer Science Teaching Diary on 20 - January 2023 at 06:12 AM (2 weeks ago) 69 views.

Saving time whilst providing accurate information about a students progress isn't easy, but certainly worth it...

I wrote a report card generator. The GitHub repo is here. It's version 0.1 but I used it and it saved me some time. There are many things to add and edit, but perfection is the enemy of good (I'm not sure I got that quote right). 

I'm hoping to eventually offer it as a web service for students and parents to use so we can co-create a story about student learning. 


Displaying courses in grid format on moodle homepage

Posted in Computer Science HOWTO Teaching Diary on 16 - December 2022 at 03:34 PM (one month ago) 93 views.

After much searching I was lucky to get a helpful reply from a friendly moodler. Read on...

On the front page of moodle when using the boost theme, there is a linear list of courses. If you want a grid of courses, you can use the suggestion from here, a plugin named filter codes. I tested this on moodle version 4.1 and it works perfectly. 


chatGPT part 3: how do I know you know?

Posted in Computer Science Teaching Diary on 10 - December 2022 at 08:57 AM (about 2 months ago) 113 views.

Out-of-school coding assignments are no longer as important as being able to understand the code. The return of oral exams?

As a computing teacher I use standard written assessments with my students. Questions include different assessment objectives such as "state", "describe" and "explain". I also use small code problems where students must solve a problem and write an answer in pseudocode. There is an internal assessment that students write; worth 25% of their final grade students must solve a problem for a real client. This is mostly independent, and a place where students could use outside tutors to solve a problem. 

For any work outside of class, I will add oral component to the assessment.

According to chatGPT, 

Some key steps for structuring an oral exam for computer science include:

  1. Determine the goals and objectives of the exam: The first step in structuring an oral exam for computer science is to clearly define the goals and objectives of the exam. This will help to ensure that the exam is focused and that it effectively evaluates the student's knowledge and understanding of the material.
  2. Identify the key topics and concepts to be covered: Once you have determined the goals of the exam, you can identify the key topics and concepts that will be covered. This could include specific programming languages, algorithms, data structures, or key theories or ideas in computer science.
  3. Create a structured format for the exam: To ensure that the exam is well-organized and focused, it's important to create a structured format for the exam. This could involve dividing the exam into different sections, each focused on a specific topic or concept, or using a specific format (e.g. Q&A, presentation, problem-solving) to evaluate the student's knowledge.
  4. Develop a list of questions: The next step is to develop a list of questions that will be used during the exam. These should be focused on the key topics and concepts covered in the exam, and should be designed to evaluate the student's knowledge and understanding of the material.
  5. Plan for student evaluation and feedback: Finally, it's important to plan for student evaluation and feedback. This could involve using a grading rubric to evaluate the student's performance, providing written or verbal feedback to the student, or allowing the student to ask questions or provide feedback on their own performance.

Overall, the best way to structure an oral exam for computer science is to carefully plan and organize the exam, focusing on the goals and objectives of the exam and the key topics and concepts that will be covered. By following these steps, you can create an effective oral exam that effectively evaluates the student's knowledge and understanding of the material.


chatGPT: teaching computing

Posted in Computer Science Teaching Diary on 04 - December 2022 at 08:14 AM (2 months ago) 155 views.

What is the answer when asking an AI to please describe the most effective techniques and methods of teaching high school computer science?

ChatGPT answers: 

There is no one-size-fits-all answer to this question, as the most effective teaching methods will depend on the specific goals and objectives of your course, the abilities and needs of your students, and the resources and materials available to you. However, there are some general principles and best practices that can help you create an effective and engaging learning environment for your students.

First, it's important to create a clear and organized syllabus that outlines the goals and objectives of your course, as well as the specific topics and concepts that your students will be learning. This will help your students understand what they can expect from the course and how they can prepare for success.

Next, it's important to use a variety of teaching methods to engage and motivate your students. This can include interactive lectures, discussions, hands-on activities, and group work. Using a variety of teaching methods can help keep your students engaged and interested in the material, and can also help students with different learning styles to succeed.

It's also important to incorporate real-world examples and applications into your teaching, to help students understand how the concepts and skills they are learning can be applied in the real world. This can help make the material more relevant and meaningful to your students, and can also help to motivate and inspire them.

Finally, it's important to provide regular feedback and support to your students, to help them understand where they are succeeding and where they may need to improve. This can include providing individualized feedback on assignments and exams, as well as offering extra help and support outside of class. Providing this kind of support can help your students feel confident and supported in their learning, which can in turn help them to succeed in your course.

Overall, the most effective techniques and methods for teaching high school computer science will depend on your specific goals and objectives, as well as the abilities and needs of your students. By using a variety of teaching methods, incorporating real-world examples and applications, and providing regular feedback and support, you can create an effective and engaging learning environment for your students.

Bill comments: 

Yea, about that.


Procedural generation as a teaching approach

Posted in Computer Science Teaching Diary on 17 - November 2022 at 05:09 AM (2 months ago) 146 views.

In computing, procedural generation is a method of creating data algorithmically as opposed to manually, typically through a combination of human-generated assets and algorithms coupled with computer-generated randomness and processing power (ref).

The amazing thing about procedural generation is that infinite unique possibilities can be created with little work from humans (ref). I've been interested in procedural for a few years, and would encourage you to take a peek at the following resources to learn about procedural generation: 

  1. This is an excellent introductory article
  2.  Dwarf Fortress (an incredibly complex game that is largely procedurally generated)
  3.  No Man's Sky (this a wiki article describing how procedural generation works)

What is cool about procedural generation is how easy it is to start with procedural generation.  In the example code below, we can get the following output: 

  1. Discovered in the small village of Tr'lor
  2. Hatched in the ocean of Greenest
  3. Born in the small village of Mirkwood

# procedural generator to write a brief history
import random

origin_1 = ["Born", "Hatched", "Invoked", "Discovered"]
origin_2 = ["in the land of", "in the wilds of", "in the forest of", "in the ocean of", "in the small village of", "in the modest hamlet of"]
origin_3 = ["Tr'lor", "Kor'mer", "Kobiyashi", "Greenest", "Mordora", "Gondor'e", "Rivendell", "Mirkwood"]

story_part_1 = random.choice (origin_1) + " " + random.choice(origin_2) + " " + random.choice(origin_3)
print(story_part_1)

I have some students working at high levels of complexity and other students working with more basic levels, as seen above. But for all of them, this is a fun approach to deconstructing a complex system, identifying the patterns within the system, and introducing the correct randomness to the system to make it unique. 

Procedural generation gets us close to modeling and simulation where a student must understand a system in order to create a model of it. In my opinion, modeling and simulation is close to the the very best learning we can get

Procedural generation goes into the stratosphere when students apply machine learning to highly complex systems. 


The design cycle works

Posted in Computer Science Teaching Diary on 08 - November 2022 at 04:59 AM (about 3 months ago) 152 views.

Considered and deliberate approach to design leads to high quality solutions. The obverse is also true.

My 9th and 10 grade (ages 15 and 16) students are working the design cycle as they solve a problem through programming. The problems are all unique, and fit the student's skill / capacity window.  An example of some the projects are below:

How to find the perfect guitar?A web-based application to help people find a guitar based on certain criteria
Which sport should you play?A web-based application help people decide what sport they might enjoy
Dungeons & Dragons character builder helperA web-based application to help people build a D&D character

The students have begun to really think and understand their problem. As they dig into the problems, I note they are changing their success criteria and more carefully adding features based on research into solutions. This process - of inquiry into a problem and understanding the problem deeply - reinforces the power of design. 

In education, we talk about transfer learning, where students can transfer learning to novel scenario or situation. A key question I like to ask is:

What do I want my students to know / be able to do in 5 years, 10 years

This kind of approach to solving problems is extraordinarily powerful, and a good thing™ to have in schools. Students who do not attend to this process generally do not have high quality solutions.


A wonderful way to learn software engineering

Posted in Computer Science on 06 - November 2022 at 04:28 AM (3 months ago) 136 views.

Authentic student projects; choice, choice, choice.

I teach two different courses primarily concerned with software engineering; 

  1. Designing Solutions Through Programming
  2. Solving Complex Problems Through Programming

In both courses I offer students a choice about what problem they want to solve. As long as the problem isn't too easy or too difficult I approve the project. This creates agency which well-serves my students. I find I get increased engagement, excitement, a sense that students are working a “real” solution which matters. From AMLE:

Student agency relates to ways that students can intentionally influence their own circumstances (Bandura, 2006). Agency can also be defined as a “student’s desire, ability, and power to determine their own course of action” (Vaughn, 2018, p. 63). Agency depends on “intentionality and forethought to derive a course of action and adjust course as needed to reflect one’s identity, competencies, knowledge and skills, mindsets, and values” (Nagaoka et al., 2015, p. 6). These elements suggest areas within which teachers can support student agency: through curriculum, instruction, assessment, and the ways in which they structure learning opportunities (source).

This is though, more difficult to manage. I like to use templates that students can alter and modify to build solutions. We deliberately and carefully learn about each part of a template so students can understand the code, and not just copy-and-paste chunks without understanding how it works. 

I plan on writing more about this, but this overall structure, where we teach students how to code, walk them through a template, and then build an authentic application allows them to transfer their learning to build applications and then “think software engineering”. 


How do we measure students computational thinking?

Posted in Computer Science Teaching Diary on 13 - May 2016 at 08:50 AM (6 years ago) 150 views.

This PDF answers the question. Good stuff.


Building a computer science wiki

Posted in Computer Science Teaching Diary on 11 - May 2016 at 01:15 PM (6 years ago) 117 views.

I've been very busy online lately, just not here 😊 Please do take a look at my computer science wiki. I'm building it for my high school, middle school, and IB students. Once it is filled-out enough, I will probably ask the internet for some help to add to it. Please enjoy, and check out the list of recent changes.


Six rules for asking questions in computer science

Posted in Computer Science Teaching Diary on 12 - April 2016 at 11:43 AM (6 years ago) 135 views.

The more complex code is, the longer it takes to understand and debug. If it is poorly written code, a multiplier is added to the time required to read it. I have worked with my students to build a "must do before asking questions" list in computer science. 

1. Google your question 
2. Re-read your code (or function). It can be helpful to read this backwards 
3. Use debugging tools 
4. Ask the person next to you 
5. Read error messages! 
6. If you have to ask a teacher for help, make sure you ask a very specific question about a very specific topic

 Great questions get great answers. Bad questions get, well, not-great answers.


Increasing complexity == increasing time to read

Posted in Computer Science Teaching Diary on 08 - April 2016 at 11:32 AM (6 years ago) 109 views.

I need some advice about a common question: "can you look at my code really quickly"? I am starting to work on increasingly sophisticated programs with my students. My students ask me to help them diagnose a problem, suggest alternatives, or figure out what is broken in their code. My problem is reading their code takes time, thinking about what they are doing takes time, and suggesting a good alternative takes time. This isn't something I can do in 30 seconds. How do you manage student requests for support and assistance when their code is very complex and requires more than 5 or 10 minutes to read? 


Object construction

Posted in Computer Science on 02 - April 2015 at 10:30 AM (7 years ago) 128 views.

connecting new learning to learning in the past

I'm continuing my learning in JavaScript. 

Today, I reviewed and refreshed my understanding about objects, and object instantiation. 

I have always clearly understood creating, modifying, and deleting objects and their attributes. Today, though, I learned a new term: object literal notation and object constructor

In my PHP work, I've seen "constructor" term, and truthfully, never fully understood it. After review and practice today, I see how it works. 

It's funny, I always "hook" my new learning onto something I learned in the past. In this case, my work building text-based games was instrumental in my understanding of objects. @create foo; @set foo=thing/value, etc... 

I have forgotten how much I enjoy /just coding/ and hacking. It is a real pleasure.


Computational thinking, Minecraft and a 5 year old?

Posted in Computer Science on 30 - March 2015 at 11:59 AM (7 years ago) 114 views.

According to wikipedia, the primary characteristics of computational thinking are decomposition, data representation, generalization/abstraction, and algorithms. 

Specifically, computational thinking is a problem solving framework where: Analyzing and logically organizing data Data modeling, data abstractions, and simulations Formulating problems such that computers may assist Identifying, testing, and implementing possible solutions Automating solutions via algorithmic thinking Generalizing and applying this process to other problems ...are used to approach problems. How then, can we use minecraft to help a 5 year old (my daughter) start to understand these concepts? 

I think the best way is to build a trap for monsters. Firstly, she would have to use cause-and-effect thinking. She would also need to break the trap into it's different parts. She would need to design a trap, and test it. In broad strokes, we will approach like this: 

  1. Define the problem (zombies, skeltons, and creepers)
  2. Understand the component parts of a trap
  3. With the component parts, she will design a trap
  4. She will test the trap
  5. She will generalize ways the trap can be used in other situations 

Ok, I'll be honest, this isn't a good example of computational thinking. The classic decomposition, data representation, generalization/abstraction, and algorithms are not really present. But this would get us on a good road, wouldn't it? What do you think?


Yea! I learned something that I actually used!

Posted in Computer Science Teaching Diary on 24 - March 2015 at 01:39 PM (7 years ago) 144 views.

I'm refershing my javascript skillset by going through a code academy course. Laborious, but helpful. Today, while supporting a co-worker on a powerschool customization, we were looking at a problem. I realized a variable was declared within a function but wasn't scoped to be used outside of the function (globally). Once fixed, we were running strong. I just studied variable scope in my refresher course, and I'm grateful I did! As always, the wonderful stack exchange has a well-written piece about variable scope within javascript. I suppose it is mildly depressing that I am excited about learning something that I can actually use. That must mean I normally learn things that are useless.


What is computational thinking in K-12 space?

Posted in Computer Science on 20 - March 2015 at 10:13 AM (7 years ago) 105 views.

Any look at computer science in the K-12 space leads inexorably towards the notion of computational thinking. My elevator speech on computational thinking is "thinking to computer". But there are many other, far better sources we can find below: From Google comes this excellent answer Computational thinking (CT) involves a set of problem-solving skills and techniques that software engineers use to write programs that underlie the computer applications you use such as search, email, and maps. Here are specific techniques. Decomposition: Breaking a task or problem into steps or parts. Pattern Recognition: Make predictions and models to test. Pattern Generalization and Abstraction: Discover the laws, or principles that cause these patterns. Algorithm Design: Develop the instructions to solve similar problems and repeat the process. From the CSTA: “CT is an approach to solving problems in a way that can be implemented with a computer. Students become not merely tool users but tool builders. They use a set of concepts, such as abstraction, recursion, and iteration, to process and analyze data, and to create real and virtual artifacts. CT is a problem-solving methodology that can be automated and transferred and applied across subjects. The power of computational thinking is that it applies to every other type of reasoning. It enables all kinds of things to get done: quantum physics, advanced biology, human–computer systems, development of useful computational tools.” Computational thinking is thus a problem-solving methodology that can interweave computer science with all disciplines, providing a distinctive means of analyzing and developing solutions to problems that can be solved computationally. With its focus on abstraction, automation, and analysis, computational thinking is a core element of the broader discipline of computer science and for that reason it is interwoven through these computer science standards at all levels of K–12 learning Page 9 of the CSTA K-12 computer science standards. From Jeannette Wing, regarding as the originator of computational thinking: Computational thinking is a fundamental skill for everyone, not just for computer scientists. To reading, writing, and arithmetic, we should add computational thinking to every child’s analytical ability. Just as the printing press facilitated the spread of the three Rs, what is appropriately incestuous about this vision is that computing and computers facilitate the spread of computational thinking. Computational thinking involves solving problems, designing systems, and understanding human behavior, by drawing on the concepts fundamental to computer science. Computational thinking includes a range of mental tools that reflect the breadth of the field of computer science.


What is computer science in a K-12 school?

Posted in Computer Science on 19 - March 2015 at 09:13 AM (7 years ago) 91 views.

Computer science isn’t learning to use excel. Computer science isn’t about understanding system administration and packet shaping. It’s not about using simulations to better understand biology. 

I think K-12 schools can get confused about the difference between computer science, information technology, and educational technology. They are distinct. 

Computer science is the scientific and practical approach to computation and its applications. It is the systematic study of the feasibility, structure, expression, and mechanization of the methodical procedures (or algorithms) that underlie the acquisition, representation, processing, storage, communication of, and access to information, whether such information is encoded as bits in a computer memory or transcribed in genes and protein structures in a biological cell An alternate, more succinct definition of computer science is the study of automating algorithmic processes that scale.

 A computer scientist specializes in the theory of computation and the design of computational systems source here. There are many reasons K-12 schools don’t “do” computer science well. I suspect one of the larger reasons is the confusion about simple definition. I've seen "computer class" as a catch-all. 

From Running on Empty comes an excellent description of why computer science is difficult to define and implement in K-12 schools: Consistent with efforts to improve “technology literacy,” states are focused almost exclusively on skill-based aspects of computing (such as using a computer in other learning activities) and have few standards on the conceptual aspects of computer science that lay the foundation for innovation and deeper study in the field (for example, develop an understanding of an algorithm). 

As I learn and explore computer science in K-12 space, I would be curious to hear your thoughts about computer science in K-12.