Self Portrait of Artificial Intelligence by Dall-E2.

AI for Developers-to-be: Thoughts and Tips

The year 2023 is starting a new chapter in how we work and live as AI becomes more accessible to everyday people. The previous event of this scale was the coming of blockchain in 2017. However, the AI technological leap potentially brings more change to more people in a shorter timeframe.

Let’s start with programmers as their benefits are most tangible — they’ve got new powerful tools like Github Copilot. And while seasoned developers question the ethical grounds of GitHub using others’ opensource work to make profit, newcomers are hoping to accelerate their careers with these wonderful tools.

Copilot’s code completion abilities are pretty amazing. It saves time on repetitive tasks and offers solutions, many of which turn out to be right. However, don’t get too charmed with its seeming brilliance — it can also introduce some hard-to-catch bugs or omit essential details.

That said, stats confirm that developers using AI are overperforming the uninitiated: according to GitHub’s research, developers who used GitHub Copilot completed their tasks 55% faster than the those who didn’t [source].

Besides Github Copilot, there are other similar services like Tabnine or CodegeeX, plus some Python-only services, and of course, we’ve got AI-powered chatbots, first of all, the famous GPT chat.

One of possible effects of AI becoming available for the wide public could be the rise of no-code programming and the influx of AI-taught people without programming experience to the industry. Some of those newcomers could be pretty well educated, proactive, highly ambitious, and have the potential to surprise us with smart, out-of-the-box projects.

So how can AI help produce working apps with minimal to none prior programming knowledge? Let’s try creatiing an example minimal React to-do app without writing any code manually.

Head over to chat.openai.com and type: Help me build a minimal react todo app to deploy on codepen.

(Codepen is a free service providing preinstalled environements.)

OpenAI’s answer is fast and positive. The instructions follow:

“First, let’s create a new React app using CodePen. In CodePen, create a new Pen, and then select the React template from the dropdown menu. This will give you a basic React template to start with. Next, let’s add some code to create the todo app. Here’s an example of what your code might look like. Once you’ve added this code, you should be able to see a simple todo app in action. You can add new todos by typing them into the input field and clicking the “Add” button. To deploy this app to CodePen, simply save your Pen and it will be automatically deployed to a unique URL that you can share with others.”

import React, { useState } from 'react';
import ReactDOM from 'react-dom';

function TodoApp() {
  const [todos, setTodos] = useState([]);
  const [inputValue, setInputValue] = useState('');

  function handleAddTodo() {
    if (inputValue !== '') {
      setTodos([...todos, inputValue]);
      setInputValue('');
    }
  }

  return (
    <div>
      <h1>Todo App</h1>
      <ul>
        {todos.map((todo, index) => (
          <li key={index}>{todo}</li>
        ))}
      </ul>
      <div>
        <input
          type="text"
          placeholder="Add a new todo"
          value={inputValue}
          onChange={(e) => setInputValue(e.target.value)}
        />
        <button onClick={handleAddTodo}>Add</button>
      </div>
    </div>
  );
}

ReactDOM.render(<TodoApp />, document.getElementById('root'));
Expand

If you were following, now you probably see… a blank sreen. Yes, nothing will work until you: 1) fix the React scripts location (lines 1-2) and 2) add to the “HTML” section the indispensable code the AI forgot to mention.

<body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
</body>
import React, { useState } from "https://cdn.skypack.dev/[email protected]";
import ReactDOM from "https://cdn.skypack.dev/[email protected]";
...

Luckily, this issue can be easily fixed by googling codepen create react app and using a working React app template instead of setting up a new one.

You can see the working example in action on Codepen.

The lesson is clear: better not take the AI’s hints at face value, however smart and bright they seem to be, and always check their validity before putting to use.

By accepting the AI’s hint, we’re including code of unknown origin, and if by chance that code was compromised, then our app can be compromised as well.

Be also aware of what you’re feeding into the AI. This information can stay forever in its immense depths and you never can’t be sure it won’t reappear elsewhere. Does running proprietary code through a generative AI tool count as disclosure?

These questions are just an example of uncertainty that still surrounds AI, and we can expect more in the near future.

Conclusion

AI is rapidly changing the programming landscape. As with any new technology, there are potential risks and ethical considerations to be aware of. It’s important to carefully vet and validate the suggestions made by AI tools before implementing them in order to ensure the security and reliability of our code.

Overall, the integration of AI in programming has exciting potential and can revolutionize the industry. Let’s just hope this revolution will bring more benefits to the people, be it new, more interesting and fulfilling work, or free time and universal basic income to travel on Mars! What are your thoughts and questions on this matter? Come to Telegram to share!

View more
Cookies settings
Accept
Privacy & Cookie policy
Privacy & Cookies policy
Cookie name Active

Who we are

Our website address is: https://martlet.live.

Comments

: When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection. An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

Media

If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

Cookies

If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year. If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser. When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed. If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

Embedded content from other websites

Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website. These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

Who we share your data with

If you request a password reset, your IP address will be included in the reset email.

How long we retain your data

If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue. For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

What rights you have over your data

If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

Where your data is sent

Visitor comments may be checked through an automated spam detection service.
Save settings
Cookies settings
Scroll to Top