DEV Community

Orbit Websites
Orbit Websites

Posted on

The Prompt Has Consumed Me: How AI is Changing the Face of Coding Forever

The Prompt Has Consumed Me: How AI is Changing the Face of Coding Forever

AI isn't just assisting developers — it's reshaping how we write, debug, and think about code. Tools like GitHub Copilot, ChatGPT, and CodeLlama are turning natural language into working software. The prompt has become as powerful as the compiler.

In this hands-on tutorial, I’ll walk you through building a simple web app entirely using AI-generated code, step by step. No prior experience needed — just curiosity and a willingness to let AI do the heavy lifting.

By the end, you’ll have:

  • A working Flask web app that generates jokes
  • Real experience using AI to write, debug, and improve code
  • A new understanding of how prompts are the new programming interface

Let’s get started.


Step 1: Set Up Your Environment

First, create a project folder and set up a virtual environment:

mkdir ai-joke-app
cd ai-joke-app
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
Enter fullscreen mode Exit fullscreen mode

Install Flask:

pip install flask
Enter fullscreen mode Exit fullscreen mode

Now, instead of writing code from scratch, we’ll prompt an AI to generate it.


Step 2: Generate the App with a Prompt

Open your favorite AI assistant (I’m using ChatGPT, but Copilot or Claude work too).

Prompt:

"Write a simple Flask web app that displays a random joke on the homepage. Use a list of 5 jokes hardcoded in the Python file. Return the joke in an HTML page with a clean, centered layout using inline CSS."

The AI might return something like this:

from flask import Flask
import random

app = Flask(__name__)

jokes = [
    "Why don't scientists trust atoms? Because they make up everything!",
    "I told my wife she was drawing her eyebrows too high. She looked surprised.",
    "What do you call a fake noodle? An impasta!",
    "How do you organize a space party? You planet!",
    "Why don't skeletons fight each other? They don't have the guts."
]

@app.route('/')
def home():
    joke = random.choice(jokes)
    html = f"""
    <html>
        <head><title>AI Joke Generator</title></head>
        <body style="font-family: Arial, sans-serif; text-align: center; margin-top: 100px; background-color: #f0f8ff;">
            <h1>Here's a Joke for You 😄</h1>
            <p style="font-size: 18px; color: #333;">{joke}</p>
            <br>
            <a href="/" style="text-decoration: none; color: #007BFF; font-weight: bold;">Tell me another!</a>
        </body>
    </html>
    """
    return html

if __name__ == '__main__':
    app.run(debug=True)
Enter fullscreen mode Exit fullscreen mode

Save this as app.py.


Step 3: Run the App

Back in your terminal:

python app.py
Enter fullscreen mode Exit fullscreen mode

Visit http://127.0.0.1:5000 in your browser. You’ll see a joke! Click "Tell me another!" to get a new one.

🎉 You’ve just built a working web app — without writing a single line of code yourself.

But let’s go deeper.


Step 4: Improve the App Using AI Feedback

Now, let’s enhance the app. Use this prompt:

"Improve the Flask app by adding a 'Submit Your Own Joke' form. Store jokes in a list and allow users to add new ones. Keep the design clean and responsive."

AI might return an updated version. Here’s a snippet of what you’ll likely get:


python
from flask import Flask, request, render_template_string

app = Flask(__name__)
jokes = [ ... ]  # your original jokes

# Updated route with form
@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST':
        new_joke = request.form.get('joke')
        if new_joke:
            jokes.append(new_joke)

    joke = random.choice(jokes)
    html = """
    <html>
        <head><title>AI Joke Generator</title></head>
        <body style="font-family: Arial, sans-serif; text-align: center; margin: 40px; background-color: #f9f9f9;">
            <h1>😄 AI Joke Generator</h1>
            <p style="font-size: 18px; color: #333;">{{ joke }}</p>

            <hr style="width: 50%; margin: 30px auto; border: 1px solid #ddd;">

            <h3>Add Your Own Joke</h3>
            <form method="POST" style="margin: 20px;">
                <input type="text" name="joke" placeholder="Enter a funny joke..." 
                       style="padding: 10px; width: 300px; font-size: 16px; border: 1px solid #ccc; border-radius: 4px;">
                <button type="submit" style="padding: 10px 15px; font-size: 16px; background-color: #007BFF; color: white; border: none; border-radius: 4px; cursor: pointer;">
                    Add Joke

---

☕ **Factual**
Enter fullscreen mode Exit fullscreen mode

Top comments (0)