Will AI Replace Software Developers?
This blog post continues our experiments with Generative AI for writing SQL and coding. The first experiment showed outstanding results for SQL writing. Text-To-SQL feature created correct answers for Leetcode's SQL Challenges. More details are in the original Blogspot.
So will AI replace software developers? To answer the question, let's do the very same experiment. We will solve LeetCode challenges with AI for coding and see if my results will be correct.
Why Use Metatable.ai Instead of ChatGPT or Github Copilot?
Before diving into LeetCode's Challenges, you may ask questions like:
Is Metatable better than ChatGPT or GitHub Copilot?
What are the benefits of using Metatable.ai?
TLDR: Image from Tweet by 0xgaut:
The differences between Metatable vs. ChatGPT vs. GitHub Copilot:
Instant building and deployment. Metatable.ai can compile and deploy code. If you want to build and deploy software applications, Metatable would be the most accessible platform to do so. You won't find such with Github Copilot or ChatGPT, where AI generates code, and then you have to run it somewhere, validate for errors, and bring it back to AI for fixing or changes. At metatable.ai, you do it in seconds under the same platform;
Better UX. With ChatGPT, you must do 'prompt engineering' to prepare enough context for the model to write proper code. Metatable provides the full context of your project, including the database schema, existing codebase, and your project description.
Recently we announced a Full AI setup where you describe your project in simple language and Metatable designs and build a backend including a database and five endpoints. Check out a detailed blog post for a Full AI setup.
So, Metatable is the ultimate software development platform. With Metatable.ai you don't have to worry about any environment or infrastructure setup. ChatGPT or Github Copilot provides just code that needs to be run somewhere.
Text to Code with Metatable.ai
So let's dive into the coding challenges at LeetCode. Metatable writes code with Rust language, so we will choose only those challenges with Rust implementation.
Why Rust? - because it is officially the most-loved language seven years in a row. But not only because of that, there will be a separate post on Metatable's technology stack.
To solve the challenges using Metatable.ai, I will follow these steps:
Inside Metatable.ai, we will create a new function for each challenge;
We will use the Leetcode's challenge description as a prompt to generate code with AI;
Then we will copy and paste the generated code from Metatable's interface back into the LeetCode's challenge interface.
Now let's go!
Challenge 1 - Easy task: two sum
Step 1. Creating function two_sum
Step 2. Copy the task description from LeetCode and paste it into the function, so that AI can code the solution.
Note that we added into the prompt how we want AI to code the solution:
When AI generated the code I just copied all within impl Solution
The code written by AI beats 83% of users who used Rust. Good result.
However, memory use was sub-optimal, only beating 5.98% of users.
Challenge 2 - Medium task: add two numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
We copied this text and put it into Metatable's chat with AI. Note that in order to be accepted at Leetcode we needed the solution to be wrapped into:
Here is where interesting things started to happen. So, we created a new function at Metatable.ai and copied Leetcode’s description into the chat with AI asking it to write code in Rust.
So what happened:
The model wrote a code which was accepted by leetcode and beat 71.47% in terms of runtime (3 ms) and 2.04 memory use beating 93.73% of users with Rust.
Due to Metatable’s prompt pipeline and infrastructure configuration the solution was put into the endpoint and deployed to the web server. So it is available online and solves the problem via API 🙂. So not only it was able to solve the challenge, it also created an Endpoint with the solution!
You can check this API by sending POST request with this
curl -X POST https://bn6jt9dpjfncfhlhf0lw.metatable.ai/addtwonumbers -H 'Content-Type: application/json' -d '{"l1": [2,4,3], "l2": [5,6,4]}'
In return you'll get the result:[7,0,8]
Challenge 3 - Hard task: median of two sorted arrays
Let’s try a hard task and see AI could write code for it. So we're doing the same things:
Creating function named
median_of_two_arrays
Pasting task description to chat with AI.
We added a short demo of how AI solves Leetcode's hard coding challenge.
The result beats 100% of users by Runtime (0ms) and 84.52% users by Memory (2.06 Mb).
Again Metatable.ai not only coded the solution, but it also built it and deployed to the sever. All with one single prompt of LeetCode's task description.
We've published the project with all 3 functions to Metatable's community, so you can check the code.
Conclusion
We tried three coding challenges at Leetcode using Metatable's code with an AI feature;
All three coding challenges were succuessuly complete with above-average scores;
We simply copied and pasted task descriptions with minimum instructions like
put impl Solution
so it's accepted by Leetcode.
Metatable.ai's AI assistance is truly impressive. We think it complements developers rather than replacing them.
Instead of fearing job displacement, we should embrace the enhancement it offers. Metatable.ai empowers developers to code more efficiently, saving time and effort. It streamlines complex coding tasks, leaving the creative and analytical aspects to the human mind.
We aren't looking at a bleak future where AI replaces the human coder. Rather, we're witnessing the advent of smarter, more efficient coding, where the developer and Artificial Intelligence walk hand in hand.
In a nutshell, with Metatable.ai, we are not just selling a product; we are selling a vision of coding enhanced with AI a smarter, more dynamic way to navigate the coding world.
The future of coding is here, and it's smarter than ever. So, dive in, explore, and embrace the redefined coding experience that Metatable.ai brings to your fingertips.
So, are you ready to give your ideas wings? Sign up for early beta at beta.metatable.ai. and enjoy developing with AI at turbo speed!