avatarLuca Vettor

Summary

AI is poised to assist or replace certain aspects of human software development, focusing on code generation rather than problem-solving within the business context.

Abstract

The provided content discusses the potential impact of AI on the role of human software developers, particularly front-end developers. It presents a scenario where ChatGPT, an AI model, quickly generates code for a React-based website that streams YouTube videos, demonstrating the efficiency of AI in automating the coding process. The article argues that while AI can significantly speed up the task of writing code, it is less capable of handling the complex business context that requires problem-solving skills. It emphasizes that developers who focus on understanding and addressing real-world problems will remain indispensable in the software industry. The author suggests that AI tools like ChatGPT are best used as accelerators for the more mechanical aspects of software development, such as implementing known patterns and behaviors, rather than as replacements for human ingenuity in crafting software solutions with business value.

Opinions

  • AI, particularly tools like ChatGPT, can automate code generation, potentially replacing human developers in this aspect.
  • The speed at which AI can write code is significantly faster than human developers, as demonstrated by the example provided.
  • The true value of software development lies in addressing business problems, which is a human-centric task that AI cannot fully automate.
  • Human developers who engage in problem-solving and defining business contexts will continue to be essential, even as AI takes over more routine coding tasks.
  • AI can serve as a powerful tool to enhance the productivity of developers by handling the mechanical parts of software creation, freeing humans to focus on more strategic aspects of development.
  • The code generated by AI without business context or purpose is considered trivial and not reflective of the complex problem-solving that gives software its true value.
  • The adoption of AI in software development will likely lead to a shift in the skill set required by developers, with a greater emphasis on problem-solving and understanding the nuances of business contexts.

Will AI Replace Human Software Developers?

Spoiler: It depends on what the software is meant to be

Photo by The Jopwell Collection on Unsplash

Let’s try together. I want to ask ChtaGPT to provide a step-by-step guide to developing a website that streams a video from YouTube.

In the prompt, I specify that,

  • I want the website to be developed in React
  • I want to use free development tools only
  • I have a Mac laptop
  • I’m a junior front-end developer

This is the actual prompt:

Please write a step-by-step guide to developing a website in React. I’m a junior front-end developer with a Mac laptop without development software: please tell me what I need and restrict the choice to free tools. Last but not least, write the website code.

The following paragraph is the answer by ChatGPT.

The ChatGPT answer

Certainly! Here’s a step-by-step guide to developing a website using React, tailored for a junior front-end developer with a Mac laptop and free tools:

Step 1: Set Up Your Development Environment

1. Install Node.js: Visit the Node.js website and download the latest LTS version for macOS. Follow the installation instructions. 2. Install a Text Editor: You can use Visual Studio Code, Atom, or any other text editor of your choice. These are free and widely used by developers.

Step 2: Create a New React Application

1. Open Terminal: Launch Terminal on your Mac.

2. Install Create React App: Run the following command in Terminal to install Create React App globally:

npm install -g create-react-app

3. Create a New React App: Navigate to the directory where you want to create your project and run:

npx create-react-app my-react-app

Replace `my-react-app` with your desired project name.

4. Navigate to Your Project Directory: Use `cd` command to navigate into your project directory:

cd my-react-app

Step 3: Develop Your Website

  1. Start the Development Server: Run the following command to start the development server:
npm start

This will open a new browser window with your React app running locally.

2. Open Your Text Editor: Open your project directory in your chosen text editor.

3. Edit the Code: Navigate to the `src` directory and start editing the `App.js` and other files as needed to build your website. React components are typically written in `.jsx` files.

Step 4: Build Your Website

1. Create Components: Break down your website into reusable components. Create new components in the `src` directory as needed.

2. Styling: You can use CSS for styling your components. Alternatively, you can use CSS-in-JS libraries like styled-components or CSS preprocessors like Sass.

3. State Management: Utilize React’s state and props for managing the data flow within your components. You can also use libraries like Redux for complex state management.

4. Routing: If your website has multiple pages, you can use React Router to handle routing within your application.

5. Testing: Write tests for your components using libraries like Jest and React Testing Library to ensure the reliability of your code.

Step 5: Deploy Your Website

1. Build Your Application: Run the following command to build your React application for production:

npm run build

2. Deploy Your Application: You can deploy your React application to various platforms like Netlify, Vercel, or GitHub Pages for free hosting.

Example React Website Code (App.js):

import React from 'react';
import './App.css';
function App() {
 return (
 <div className="App">
 <header className="App-header">
 <h1>Welcome to My React Website!</h1>
 <p>Start building your website here…</p>
 </header>
 </div>
 );
}
export default App;

This is a basic structure of a React component. You can further expand and customize it according to your website’s requirements.

That’s it! You’ve now set up your development environment, created a new React application, developed your website, and deployed it. Happy coding!

What did we get from ChatGPT?

If you are a junior developer, please follow the step-by-step instructions in the previous paragraph; they work. If you are a senior developer, you know all that works without trying.

You can even ask ChatGPT to write the code for streaming a YouTube video within the React app; this is the result:

import React, { useState } from 'react';
import YouTube from 'react-youtube';

function App() {
  const [videoId, setVideoId] = useState('');

  const handleSubmit = (event) => {
    event.preventDefault();
    // Extract video ID from YouTube URL
    const url = event.target.elements.url.value;
    const videoIdMatch = url.match(/(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([^?&]+)/);
    if (videoIdMatch && videoIdMatch[1]) {
      setVideoId(videoIdMatch[1]);
    } else {
      alert('Invalid YouTube URL');
    }
  };

  return (
    <div className="App">
      <h1>YouTube Video Player</h1>
      <form onSubmit={handleSubmit}>
        <input type="text" name="url" placeholder="Enter YouTube URL" />
        <button type="submit">Play Video</button>
      </form>
      {videoId && (
        <div style={{ marginTop: '20px' }}>
          <YouTube videoId={videoId} />
        </div>
      )}
    </div>
  );
}

export default App;

Again, try it; it works.

Let’s say that all the code below takes 5 minutes for a senior front-end developer. ChatGPT took 5 seconds, which is about 98% faster.

Impressive.

Does this mean ChatGPT will soon replace most front-end developers? The answer depends on what software is meant to be, either writing code or solving problems.

The difference is that solving problems requires a business context while writing code is manipulating other running code.

Defining the business context is an arduous task to automate as it depends on many interdependent human aspects that are complex to formalize. Instead, given the behavior of software, it’s a mechanical task to automate how to use it, and ChatGPT proves this.

Wrap up

Will AI trends in software development replace human developers? The answer I propose is now straightforward to formulate: human developers who write code will soon be replaced by AI. Instead, human developers who solve problems will stay ahead and speed up their daily tasks thanks to AI.

Consider my fake impressive example with ChatGPT: that code that streams a video from YouTube doesn't have a business purpose, is trivial, and doesn't fit into any architectural design. In other words, it's worth zero.

That’s the point: worthy software is a human endeavor. Automation is to speed up details.

Thanks for reading!

If this piece made you think, please follow me!

Programming
AI
Software Development
Mindset
Word Wave
Recommended from ReadMedium