In the last few months after ChatGPT was released by OpenAI, you must have seen youtube videos by influencers claiming ChatGPT will replace software engineers and will put them out of their jobs and so on.
Essentially they asked ChatGPT to write a program like reverse a word, remove duplicates, etc and ChatGPT replied with the correct code.
Because of this, they claimed this is the end of software engineers like all they do is write this stupid code when they are working right?
The truth is these so-called youtube influencers have never actually worked as software engineers because if they had they would know that software engineering is 30% code and 70% resolving infrastructure issues, improving system performance, and fixing bugs. And even the 30% code is not the stupid programs they asked ChatGPT, it is actually real business logic that requires days of planning, requirement gathering, and meeting different stakeholders, etc which AI can never do.
But still, as a software engineer, I was curious to know more about ChatGPT and all the things it can do and also see whether there is any truth in these so-called influencers’ words. So I tested ChatGPT with real-world questions which we implement every day as software engineers and which only an experienced software engineer will be able to answer.
You will not be surprised to know the result :). Hint: It failed to provide the best answer to all questions and even provided wrong answers sometimes. Here are the results
- Question: How to send JWT from an Angular application to a server?
- Question: How does the normal encryption process between frontend and backend works in banks?
- Question: How to write different test cases for a single unit test using MSTest unit testing framework in Dotnet?
- Question: Does static strings in C# cause memory leak?
Question: How to send JWT from an Angular application to a server?
Below is the answer
So is the answer correct – Yes but
This is not the correct way to do it. In real-world applications, we use an interceptor that intercepts the request and assigns a header with JWT for each request. The above method shown by ChatGPT will lead to the repetition of code if we do it for each request or for each service.
So ChatGPT failed to provide the best answer here.
Question: How does the normal encryption process between frontend and backend works in banks?
Here is the answer
So is the answer correct – No
ChatGPT says SSL is used to encrypt data in frontend but SSL is actually an encryption security protocol that encrypts data while transferring between two systems so that nobody can read the data in its journey. But there are still certain loopholes that can be used to read data at both ends of the transfer if there is no additional encryption applied.
For this reason, we apply our own encryption on data that is in plain text before transferring it from frontend to the server. Typically, having worked on a banking project, the encryption process works like this
1) data(plain text) is encrypted using AES, which uses same key for both encryption and decryption. This key is a 128 or 256-bit randomly generated string which is new for each request. In our case, only half of the AES key was used to encrypt data to confuse hackers.
2) Then AES key is encrypted using RSA public key and attached to the request object.
3) data is sent from frontend to server where an additional layer of encryption is applied by SSL.
4) data is received by the server that contains the AES encrypted key.
5) AES key is decrypted using RSA private key on the server.
6) data is decrypted using the decrypted AES key.
So again, incorrect answer was provided by ChatGPT.
Question: How to write different test cases for a single unit test using MSTest unit testing framework in Dotnet?
The answer you can see in the below image
So was the answer correct – Yes but 🙂
Do we use this answer in real-life projects – No.
The answer suggests using Attributes for each test case and passing data to the method using parameters. In real-world projects, we have like 5, 10,15, and sometimes 20 or more test cases for a piece of code. So we cannot and should not write 20 different attributes above a method. In this case, the correct method to use is to pass data using DynamicData(more about it here) and define a separate method where we define all our test cases. This way, our test cases look much more readable and easy to understand.
In the last paragraph, ChatGPT suggested using “TestCaseSource” which is used in the NUnit testing framework of C# and I asked question about MSTest unit testing framework. So it actually provided wrong information as well.
I must note that it did suggest using separate function to pass data in the last paragraph but for wrong testing framework. And also the first answer that it gave should be considered the best answer and its best answer was not the correct way to do it.
Question: Does static strings in C# cause memory leak?
Here is the answer
Again the answer is contradicting itself and is incorrect.
First, it says static strings do not cause memory leaks but later it also says static strings are stored in the memory for the lifetime of the application.
Actually, GC Root objects are marked as not-to-collect by the collector, and static variables are one of them. This means that static variables and everything they reference will never be garbage collected. So the answer is wrong.
These were the few questions I asked and as you saw, ChatGPT did not provide the best answer to any question and also provided wrong answers as well.
And these were just straightforward questions that we asked but to replace software engineers ChatGPT will need to do this 🙂
Question: Can you please fix the error that XXXX endpoint of YYYY company is throwing?
Answer from ChatGPT: yes sure
1) ChatGPT hacks into your system and logs onto AWS account and checks logs.
2) After finding the error, it opens VS code and tries to recreate the same scenario locally.
3) It debugs and fixes the code and creates a PR in dev environment.
4) Asks team member to review it.
5) Team member merges the PR and now tester starts testing it.
6) Tester finds a new bug because of the code changes and will again need to be fixed.
7) ChatGPT will again have to debug the code locally and fix it but oh wait
8) A new docker update broke all containers and now you have to reinstall the old version.
9) You don’t have permission to install software so ChatGPT mails the IT team to reinstall it.
10) After docker has been reinstalled, code fixes are done and PR is made which is merged and tested and has also been merged in staging environment.
11) Another tester starts testing it and finds two new bugs which are not even related to your code but now they have come up so you have to resolve them.
12) Meanwhile the manager has asked 3 times why new changes have not been released yet even after 2 days so ChatGPT will also have to answer him on Slack or email.
13) after fixing new bugs changes have been tested and approved in dev and staging and finally are ready for release.
Can ChatGPT do all this? well No 🙂
So youtube influencers sorry ChatGPT cannot replace software engineers.
Thanks for reading, Have a nice Day
Hope you liked the post, Thanks for reading 🙂