Navigating the Black Box of AI-Written Code

Jeremiah Moore
5 min read2 days ago

--

As AI takes on more coding tasks, the need for understanding and control remains crucial. Explore how to harness tools like Cline, Replit, Aider, and Cursor effectively.

In the rapidly evolving tech landscape, AI’s role in coding has transitioned from experimental to essential. Tools like GPT models, Codex, and other language models (LLMs) are not just assisting developers but are starting to write significant portions of code themselves. While this revolution brings undeniable efficiency and speed, it also introduces a significant challenge: Complacency due to “Absent Brainism,” where AI writes code that developers may not fully understand or know how to troubleshoot.

The Pitfalls of Black Box Programming

Absent Brainism refers to a growing concern among developers that reliance on AI to write code could lead to a lack of deep understanding of the codebase. This situation is akin to using a calculator without understanding the math — it works until it doesn’t, and then one is left without the knowledge to troubleshoot or alter the outcome effectively. The problem intensifies when AI-generated code functions like a “black box” where inputs and outputs are clear but the process is opaque.

Navigating the Black Box with Modern Tools

To mitigate these risks, it’s crucial to employ tools that not only facilitate AI coding but also enhance understanding and control. Here are some general guidelines:

Instruct the coding assistant to include comments

Commit frequently in case you get buried in AI changes and cannot undo

Use quality LLMs with proven success in coding

Keep up to date on frameworks and libraries; LLMs may recommend deprecated dependencies or outdated bash commands

Keep those things in mind when using AI tools. There is a balance to strike between speed and code readability and efficiency.

AI Powered IDEs 🔥

Cline

Cline is an AI-powered coding assistant integrated into Visual Studio Code (VSCode). To get started:

1. Install Cline: Open VSCode, navigate to the Extensions Marketplace, and search for “Cline.” Install the extension.

2. Configure API Access: Cline utilizes AI models like Claude 3.5 Sonnet. You’ll need to set up an API key from a provider such as Anthropic. After obtaining the key, enter it in Cline’s settings within VSCode.

3. Use Cline: Open the Cline sidebar in VSCode. You can now interact with the AI assistant to help with coding tasks, such as generating code snippets, debugging, or understanding code segments. Cline can create and edit files, execute commands, and even use the browser, all with your permission.

Replit

Replit is an online coding platform that allows you to write, run, and share code directly from your browser. Here’s how to begin:

1. Sign Up: Visit replit.com and create an account.

2. Create a New Project: Click on “Create” or “New Repl,” select your desired programming language, and start coding in the provided editor.

3. Run Your Code: Use the “Run” button to execute your code and see the output in the integrated console.

4. Collaborate and Share: Replit supports real-time collaboration, allowing you to code with others simultaneously. You can also share your projects via links.

Aider

Aider is an AI pair programming tool that operates in your terminal, assisting with code editing in your local git repository. To use Aider:

1. Install Aider: Open your terminal and run:

python -m pip install -U aider-chat

2. Navigate to Your Project: Use the `cd` command to move into your project’s directory, which should be a git repository.

3. Set Up API Access: Aider works best with models like GPT-4 or Claude 3.5 Sonnet. Obtain an API key from a provider and set it in your environment variables:

export ANTHROPIC_API_KEY=your-key-goes-here

4. Start Aider: In the terminal, run:

aider

You can now interact with Aider to request code changes, additions, or debugging assistance. Aider will edit your files and commit changes to your git repository.

Cursor

Cursor is an AI-powered code editor designed to enhance your coding experience. To get started:

1. Download and Install Cursor: Visit the Cursor website, download the installer for your operating system, and follow the installation instructions.

2. Open Cursor: Launch the application to access the code editor interface.

3. Start Coding: Create a new file or open an existing project. As you write code, Cursor provides intelligent suggestions, autocompletions, and can assist with code generation.

4. Utilize AI Features: Cursor can help with code refactoring, debugging, and understanding complex code segments through its AI capabilities.

Each of these tools offers unique features to assist you in coding more efficiently. Exploring their official documentation and tutorials will provide deeper insights into their capabilities.

Promoting Better Coding Practices with AI

While these tools offer a way to work more effectively with AI coders, the true challenge lies in maintaining a balance. Developers must ensure they are not just passive recipients of AI-generated code but active participants in the coding process. This involves:

• Routine Code Reviews: Regular reviews of both human and AI-generated code to ensure quality and understanding.

• Continuous Learning: Keeping up-to-date with coding practices and new technologies to understand the foundations of AI suggestions.

• Enhanced Testing Procedures: Implementing robust testing frameworks to catch issues that may not be apparent in AI-generated code.

Looking Ahead: The Future of Coding with AI

As we look towards 2025, the integration of AI in coding will only deepen. The next frontier is likely to be more sophisticated forms of prompt engineering, where developers don’t just use tools but also tailor AI behaviors to better fit development needs. This will require an updated practice of “prompt engineering,” focusing on guiding AI to generate not only functional but also understandable and maintainable code.

In conclusion, while AI can dramatically enhance our coding capabilities, it’s crucial to remain actively involved in the process. By using tools like Cline, Replit, Aider, and Cursor, developers can maintain control over their codebases, ensuring that AI acts as an assistant rather than a crutch. The future isn’t just about writing code; it’s about understanding it thoroughly, no matter who or what writes it.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jeremiah Moore

Developer, Creator, Artist, and Human Being living in the United States