Simulating coding class assignments with AI

ยท

3 min read

I miss briefs; bring back briefs!

No, not these ๐Ÿฉฒ I'm talking about college briefs. Structured mini assignments, formatted like a workshop, and some semblance of guidance on what I need to do - training wheels if you like.

I tried asking the Googledom for some beginner PHP projects.
Build a full on content management system ๐Ÿ˜„
Build an Eccomerce System ๐Ÿ˜…
Build a whole Customer Relationship Management System ๐Ÿ˜ตโ€๐Ÿ’ซ

OK maybe not always that bad but u get the picture. Definitely great for another time but at the time I wasn't quite there yet.

A nice in-between step has been the exercises available in places like w3resources, or Code Wars if you like the spice of a bit of competition.

However it was challenging at first to find one I could do.

I needed to know what I needed to know to complete it.

Jasper to the rescue.

Jasper - Chat GTP (minus the interface) 18 months before there was a Chat GTP - has been helping me fill in the gaps.

What I ask Jasper:

Dont give me the answer, but tell me the concepts I need to solve this PHP problem.

[problem here]

Show code examples of concepts in use.
Write a PHP script to check the file extension and display appropriate messages for different file types.

I used this simple example to keep the post as clean as possible.

What Jasper returns:

Practical use of this information

Insert my solution here

An alternative approach

I wondered how Jasper would fair if I were to ask it to write a more formal brief amd create an assignment for the task.

Act like a college proffesorWrite a PHP script to check the file extension and display appropriate messages for different file types.

BTW I find Americanisms work better with these comands.

Dear Students,

In our upcoming PHP programming class, we're going to delve into a practical exercise that combines several key concepts of the language, including file handling, string manipulation, conditional statements, and associative arrays. Your assignment is to write a PHP script that checks a file's extension and displays appropriate messages for different file types.

Here are the main components you'll need to consider:

    1. File Handling: This involves opening a file, reading its contents, and closing it. PHP provides built-in functions for these tasks. Familiarize yourself with fopen(), fread(), and fclose() functions.

      1. String Manipulation: You will need to extract the file extension from the filename. This extraction can be achieved using the pathinfo() function, which returns information about a file path.

      2. Conditional Statements: Depending on the file extension, your script should display different messages. For this, you'll need to use if, else if, and else statements.

      3. Associative Arrays: Consider using an associative array where the keys are file extensions and the values are the corresponding messages. This approach can make your code cleaner and more efficient.

Your task, therefore, is as follows:

  • This exercise will test your understanding of the mentioned concepts and your ability to combine them in a functional script. Please remember that good coding practices such as proper indentation, clear naming conventions, and concise comments are just as important as getting the correct output.

Mark my work, AI

Just for fun and for completeness I asked Jasper to rate my solution.

Feedback.

Bonus, I'f I'm struggling I can do a virtual hand up and ask Jasper to help me fix the problem.

Don't tell me the answer but can you give me hitns on why this code will not work to help me investige [insert code issue]

Mark my work, Human

I asked David Carr to take a look too. Just out of curiosity.

ย