Lesson plans will always be in the hands of the human instructor.  Always. The instructor brings the creativity to the plan.  ChatGPT can do the monotonous tasks that might otherwise prohibit an instructor from considering particular elements of a plan.  Here is an example.

I currently teach an introductory course on Java development targeted toward sophomore level students.  It was time to review the concept of Java packages, a construct that organizes code files.  The trusty book, Core Java for the Impatient*, gave a good description.   I wanted to supplement it with a real world example.

My thought process was the following.  Find an open source Java project.  The project would be large and have many Java files and packages.  I would total up the number of files, the number of directories, and use that as visual proof of the utility and need for packages.  I wanted to convey that putting all your source code files in one directory simply is not a good idea.  Source code files need to be organized logically by functionality.  Java packages are the solution.

Could ChatGPT help me out with this task?  Let’s see. 

Step 1: Choose a Java open source project

I chose Apache NiFi.  No need for me to consult ChatGPT to find an open source project with many Java files.  But, what if I did?  Here is its a reply, see the image below**.  A respectable list with some I had forgotten or did not know were written in Java.  I followed up with a bunch of questions about JHipster as I was unfamiliar with it.

Step 2: Analyzing Apache Nifi

I cloned the Apache NiFi project to my MacBook Pro.  Next, I wanted to know how could I count the number of Java files in the project.  Yep, I know the Linux find command can do this.  However, I had forgotten the exact syntax.  I could have used a search engine to find resources to fill in these details.  Rather, I used ChatGPT to generate the exact Linux command needed.  That saved me minutes of time.  Here is my question with ChatGPT’s response:


Ok, great.  Note, I knew to add the ‘| wc -l’ on the end to count the number of lines in the result set returned by find. I have not forgotten all the Linux commands I once knew!

There are 8,405 Java files in the main branch of Apache NiFi.  That’s a lot of Java files!  Now my next question.  How many directories are there that hold Java files? My rationale is as follows.  I introduced the concept of packages.  I stressed they are analogous to a directory structure.  I want to demonstrate that the directory structure is fine grained.  My next directive to ChatGPT: Find me all directories that hold Java files.  Give me that sum.  Do not duplicate count the directories.  Yep, that is a set of Linux commands I would have wasted a lot of time getting to work had I used a search engine.  Here is ChatGPT’s first reply:


This reply was not quite right.  I copied and pasted it, tried it, and quickly knew what it had done wrong.  Here is my correction to ChatGPT and its revised answer.  This time, spot on.

Reply 2

There was no way I am going to efficiently search Google to find the commands to do this.  It’s been years since I have used xargs in Linux, though I do remember them.  Two items of note here:

1. ChatGPT give me a description of what the Linux commands are doing.  This is another way to expose the students to Linux and why the command line is so darn useful.

2. The total number of directories is 2008.  That is a lot!

Note, I cannot verify that every last directory in the 2008 number is part of a Java package structure.  A manual inspection of the project indicated most were.  The number is close enough and the point is made; packages evolve into fine grained structures.

Lastly, how many duplicate file names are there?  This is even more proof for the students that you simply cannot cram all the source code files into one directory.  I knew I needed a script.  Here is my directive, its fairly complex, and ChatGPT’s first reply:


Two items here:

1. ChatGPT created the script probably 20 times faster than the fastest human, bash-writing pro could’ve authored it.  I am not a bash script writing pro.  This script would have taken me probably 20 minutes to write.

2. There is an error with the script on line 11.  Something to do with + operator.  Rather than having ChatGPT figure out what, I simply said “Just do it Python.”  Here is its reply below, which worked perfectly.


This provided me invaluable content for the in-class demonstration.  Students followed along and did all these steps (the ones with the correct commands).  It clearly got them to think about the value of packages.  Later, I switched to another branch in the NiFi project to explain branching in git.  These commands demonstrated that there are different numbers of files and directories in different branches.  This conveyed that projects evolve over time.

Step 3 – Testing the student’s knowledge

In class I had created a lesson plan for Java packages.  I had wondered if ChatGPT could assist with development of questions for homework assignments and quizzes.  Well, of course it can.  See the image below when asked to create four multiple choice questions about Java packages.  Some of these would work out of the box for me.  Others, I would tweak to make slightly harder.


The capability to generate questions that match learning rubrics is invaluable.  I would cite ChatGPT were I to use the questions as part of an actual exam.


Clearly, without ChatGPT,  I would not have included this material in my lecture.  Or, if I had, it would not nearly have been as detailed.  ChatGPT offers a unique and disruptive capability to augment lesson plan development. If you know the domain well,  it can help out in so many ways.


* Link to Core Java for the Impatient – an excellent book to introduce students to Java and an object oriented programming language.

** All images are from ChatGPT and generated the week of February 6th at varying days and times.