Will ChatGPT Quickly Exchange Software program Builders? Sure or No?
11 min read
If there’s something that has caught the eye of the tech world in the previous few weeks, it’s ChatGPT. The media is projecting it as the subsequent large factor after Google Search Engine, and consultants are competing with one another in predicting its affect on society. This text tries to peek into ChatGPT from the angle of a software program developer. We’ll attempt to perceive whether or not will ChatGPT exchange jobs.
ChatGPT is a chatbot backed by synthetic intelligence. Constructed by San Francisco-headquartered OpenAI, it was introduced to the world within the month of November 2022.
Within the phrases of ChatGPT, it’s an AI assistant educated to assist reply questions and supply info on a variety of matters, together with normal information, historical past, science, arithmetic, language, and lots of others. Sounds acquainted? Are engines like google already not doing that job? There’s a distinction!
In response to OpenAI, ChatGPT has been educated to work together in a conversational means. The dialogue format makes it attainable for ChatGPT to reply follow-up questions, admit its errors, problem incorrect premises, and reject inappropriate requests.
Let’s Attempt ChatGPT
Properly, let’s expertise it! The very first thing is to log in to ChatGPT. Go to the URL https://chat.openai.com/auth/login on any trendy browser to open the login web page. It seems as in Fig. 1.

Since we haven’t signed up but, click on on the ‘Enroll’ button. It opens the dialog, providing a number of methods to enroll.
In my case, I selected to proceed with Google. After getting into the Google credentials, it prompted for a reputation and cellphone quantity to provoke the verification course of. Upon getting into the obtained OTP, the ChatGPT opened up on the URL https://chat.openai.com/chat, as in Fig. 2.

The ChatGPT clearly states that the present model is only a free analysis preview. Its aim is to get exterior suggestions with the intention to enhance its methods and make them safer. It additionally cautions that the system could often generate incorrect or deceptive info and produce offensive or biased content material, regardless of the safeguards which might be in place.
Since ChatGPT conversations could also be reviewed by AI trainers to enhance the methods, we should not share any delicate info in our conversations.
Let’s Play with ChatGPT
Programming is without doubt one of the areas by which ChatGPT proves to be a helpful assistant. As an example, kind the next query on the immediate and take a look at the response:
java command to compile a file
Other than such easy questions, we are able to even ask ChatGPT to jot down code for us. How about getting some assist in writing some Python code? I began a brand new dialog with the next immediate:
kind numbers utilizing bubble kind in python
The assistant generated the next code:
def bubble_sort(numbers):
n = len(numbers)
for i in vary(n):
for j in vary(0, n - i - 1):
if numbers[j] > numbers[j + 1]:
numbers[j], numbers[j + 1] = numbers[j + 1], numbers[j]
take a look at the perform
numbers = [3, 4, 1, 2, 5]
bubble_sort(numbers)
print(numbers) # [1, 2, 3, 4, 5]
You may confirm the code simply by reviewing it in case you’re a Python developer. Or copy the code right into a supply file, and check out operating it in a Python surroundings. It really works!
However it doesn’t simply finish there. We all know that there’s a couple of technique to write the code for bubble kind. ChatGPT agrees. I requested her to strive once more.
This time it generated the next code:
def bubble_sort(numbers):
# Set the flag to True to start out the sorting
flag = True
# Hold looping till the flag is False
whereas flag:
# Set the flag to False
flag = False
# Loop via the numbers
for i in vary(len(numbers) - 1):
# Verify if the present quantity is bigger than the
subsequent quantity
if numbers[i] > numbers[i + 1]:
# Whether it is, swap the numbers
numbers[i], numbers[i + 1] = numbers[i + 1],
numbers[i]
# Set the flag to True to point {that a} swap
has occurred
flag = True
# Return the sorted listing
return numbers
sorted_numbers = bubble_sort([3, 5, 2, 1, 4])
print(sorted_numbers) # Output: [1, 2, 3, 4, 5]
You may preserve asking it to strive any variety of occasions. In my case, the next was prompt within the third iteration:
def bubble_sort(numbers):
# We set swapped to True so the loop seems to be runs no less than
as soon as
swapped = True
whereas swapped:
swapped = False
for i in vary(len(numbers) - 1):
if numbers[i] > numbers[i + 1]:
# Swap the weather
numbers[i], numbers[i + 1] = numbers[i + 1],
numbers[i]
# Set the flag to True so we’ll loop once more
swapped = True
#Confirm it really works
numbers = [3, 7, 4, 9, 1, 6]
bubble_sort(numbers)
print(numbers) # Ought to print [1, 3, 4, 6, 7, 9]
Bored with completely different variations of the code for a similar downside? How about asking the assistant to optimize the code as a substitute? I simply typed the next on the immediate:
optimize
The next is the consequence…
There are a number of methods you'll be able to optimize the bubble kind algorithm to make it run quicker. Listed here are a couple of concepts: Use a flag to maintain observe of whether or not any swaps had been made on
the final iteration of the loop. If no swaps had been made, it means the listing is already sorted and we are able to exit the loop early.
Solely iterate as much as the final ingredient that has already been sorted. On every move, the biggest ingredient will “bubble” as much as the tip of the listing, so there’s no want to check it to every other components on the subsequent move.
Use a special sorting algorithm altogether, corresponding to fast kind or merge kind, which have higher average-case time complexity than bubble kind.
I hope these ideas are useful! Let me know when you have any questions.
I’m positive you seen that the assistant is remembering the entire dialog and answering the questions contextually.
Growth with ChatGPT
The above dialog solely illustrates how the assistant may help us in writing code for smaller issues. Nonetheless, creating software program is not only about writing code. Let’s act as if we have no idea a lot about creating Spring Boot functions and see how a lot the assistant helps us.
I began by asking the next query:
distinction between log4j and slf4j
It gave an entire lot of knowledge. Do this your self and learn how helpful it’s.
Then, I requested the next query:
spring program with slf4j
It generated the next code:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.
SpringBootApplication;
@SpringBootApplication
public class MySpringApp
personal static closing Logger logger = LoggerFactory.
getLogger(MySpringApp.class);
public static void most important(String[] args)
SpringApplication.run(MySpringApp.class, args);
logger.information(“Spring software began!”);
The assistant doesn’t wash its arms off with simply code. It offers a variety of notes as nicely. As an example, the next is the be aware generated together with the above code.
On this instance, we use the LoggerFactory class from slf4j
to create a logger for the MySpringApp class. We are able to then use
the logger object to output log statements at completely different
ranges (e.g., information, debug, error).
To make use of slf4j in a Spring software, you will want to
embody the slf4j-api library as a dependency in your
mission. Additionally, you will want to incorporate a concrete
implementation of slf4j, corresponding to log4j, logback, or java.
util.logging.
For instance, to make use of log4j because the underlying logging
implementation, you will want to incorporate the log4j library
as a dependency in your mission. You may then configure log4j
to output log statements to the specified vacation spot (e.g.,
console, file).
Since it’s advising some dependencies, I acted as if I have no idea how it may be performed. So, I requested this follow-up query:
pom file for spring with slf4j
Right here is the ensuing suggestion:
<mission>
<!-- Different mission configuration -->
<dependencies>
<!-- Different dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<model>1.7.30</model>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<model>1.7.30</model>
</dependency>
</dependencies>
</mission>
Once more, the notes prompt a log4j dependency. I requested the assistant so as to add that too, and it generated the next refined configuration.
<mission>
<!-- Different mission configuration -->
<dependencies>
<!-- Different dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<model>1.7.30</model>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<model>1.7.30</model>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<model>1.2.17</model>
</dependency>
</dependencies>
</mission>
Additionally, you will want to incorporate a log4j.properties file in your
mission to configure log4j to output log statements to the
desired vacation spot (e.g., console, file).
The story doesn’t finish right here. I requested the assistant to assist me with the log4j.properties file:
log4j.properties for spring with slf4j
It obliged.
# Root logger
log4j.rootLogger=INFO, stdout, file
# Console appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.format=org.apache.log4j.PatternLayout
log4j.appender.stdout.format.ConversionPattern=%dyyyy-MM-dd
HH:mm:ss %-5p %c1:%L - %mpercentn
# File appender
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=app.log
log4j.appender.file.format=org.apache.log4j.PatternLayout
log4j.appender.file.format.ConversionPattern=%dyyyy-MM-dd
HH:mm:ss %-5p %c1:%L - %mpercentn
I used to be thrilled. Not that we can’t get this assist from the online utilizing a search engine. However the conversational expertise with ChatGPT was simply superior.
Allow us to strive ChatGPT for one final time by taking assist in creating and deploying REST API. I began a brand new dialog with a easy query:
design relaxation api so as to add a buyer
It responded with the next clarification:
To design a REST API so as to add a buyer, you will want to
outline the endpoints and the request/response payloads for
the API.
Right here is an instance of how you can design the API:
Endpoint:
POST /clients
Request payload:
“identify”: “John Smith”,
“electronic mail”: “[email protected]”,
“cellphone”: “555-555-5555”
Fairly helpful! We usually use Swagger for documenting the REST API. There’s a variety of boilerplate in it. ChatGPT is ideal in such instances. I requested the next in the identical dialog:
swagger doc for including a brand new buyer
Right here is the Swagger documentation for the POST /clients endpoint that I described above:
/clients:
publish:
abstract: Add a brand new buyer
requestBody:
content material:
software/json:
schema:
kind: object
required:
- identify
- electronic mail
- handle
properties:
identify:
kind: string
electronic mail:
kind: string
format: electronic mail
handle:
kind: string
responses:
201:
description: The client was efficiently created
content material:
software/json:
schema:
kind: object
properties:
id:
kind: integer
format: int64
identify:
kind: string
electronic mail:
kind: string
format: electronic mail
handle:
kind: string
400:
description: The request physique is invalid
409:
description: A buyer with the identical electronic mail already
exists
What else may I ask for? The ultimate model of the documentation could not look this straightforward. But, it’s a good place to begin.
I used to be curious to see if ChatGPT may give me code for publishing the above REST API utilizing Spring Boot. It did! The query was this:
spring controller for the above endpoint
And the response was:
@RestController
@RequestMapping(“/clients”)
public class CustomerController
@PostMapping
public ResponseEntity<Buyer> createCustomer(@Legitimate @
RequestBody Buyer buyer)
// save the shopper and return it
Buyer savedCustomer = customerRepository.
save(buyer);
return ResponseEntity.standing(HttpStatus.CREATED).
physique(savedCustomer);
That is crucial Spring. These days, we choose the reactive paradigm. I requested the identical factor with this query:
i would like it with spring reactive
ChatGPT gave the starter code.
@RestController
@RequestMapping(“/clients”)
public class CustomerController
@PostMapping
public Mono<ResponseEntity<Buyer>> createCustomer(@
Legitimate @RequestBody Mono<Buyer> buyer)
// save the shopper and return it
return buyer.flatMap(buyer -> buyer
Repository.save(buyer))
.map(savedCustomer -> ResponseEntity.standing
(HttpStatus.CREATED).physique(savedCustomer));
No trendy growth is accomplished with out making a Docker picture. I took assist from ChatGPT to generate a Dockerfile for the above code with this query:
dockerfile for the above software
And I obtained the next response, which is ample to start out with:
FROM openjdk:11-jdk-slim
ARG JAR_FILE=goal/*.jar
COPY $JAR_FILE app.jar
EXPOSE 8080
ENTRYPOINT [“java”, “-jar”, “app.jar”]
As a substitute of asking for particular assist, I simply tried the next to boost the dialog:
what’s the subsequent step?
It shocked me with this reply:
Upon getting written the code on your software and created a Dockerfile, the subsequent step is to construct a Docker picture and run a Docker container.
To construct the Docker picture, open a terminal and navigate to the listing containing the Dockerfile. Then, run the next command:
docker construct -t my-app .
This can construct a Docker picture with the identify “my-app” utilizing the directions within the Dockerfile.
To run a Docker container, use the next command:docker run -p 8080:8080 my-app
This can begin a Docker container from the “my-app” picture, and map the container’s 8080 port to the host’s 8080 port.
Is there anything I may help with?
See! ChatGPT maintains the conversational context. It solutions within the given context, not simply dry static outcomes. And that’s wonderful. What else can I say? I stated:
thanks
And the assistant was ok to acknowledge.
You’re welcome! I’m glad I may assist. When you have every other
questions, be at liberty to ask. I’ll do my finest to help you.
Will ChatGPT Exchange Jobs?
I bear in mind folks arguing concerning the good and unhealthy of the computerization of banks within the Nineteen Nineties and autonomous automobiles within the 2020s. Each disruptive expertise raises this query. It’s the identical with ChatGPT as nicely.
The exact query that’s related for the software program growth group is that this: Will ChatGPT exchange builders?
At this level, the reply is clearly ‘no’. Know-how all the time destroys some jobs and creates new ones. However changing a developer takes a variety of effort. Software program growth is not only coding. Definitely, ChatGPT may help in writing code identical to IDE helps in code completion, compilation, debugging, and so on.
However, like IDE, it can’t exchange human involvement in end-to-end growth. We, as builders, used textual content editors to jot down the code within the 80s and used IDEs within the 90s.
We’ve copied code from Google search outcomes and used options from StackOverflow. All of this was performed to enhance productiveness. And but, none of them had been actually capable of exchange the developer. The identical goes to occur with ChatGPT as nicely. It’s a disruptive productive instrument for programmers. However, it neither makes you a programmer nor takes away your programming job. A minimum of for now!
This text was first printed in February 2023 concern of Open Supply For You journal.
The writer Krishna Mohan Koyya is the founder and principal guide at Glarimy Know-how Providers, Bengaluru. He has mentored and upskilled greater than 250 technical groups in architecting, designing, and creating enterprise functions on-premise in addition to on cloud