What can we do in the face of "unemployment anxiety"? Let AI help you become stronger!

I have been working in software development for 16 years since I graduated from university in 2007. In the past sixteen years, I have experienced some new technological waves. SAP, where I work, is one of the largest and most successful software companies in Europe, and its main focus is enterprise management software. I have also experienced the transformation of development thinking and concepts from local deployment software (On-Premises) to cloud-native applications, and I have personally experienced the practical convenience and work brought by virtualization technologies such as Docker and Kubernetes to developers. Efficiency improvement. But these are far from the series of AI technologies represented by ChatGPT at the beginning of this year that shocked me.

insert image description here

In fact, SAP has already released AI services for enterprise-level users that are tightly coupled with a certain segment and business. These AI services are deployed on SAP's own BTP cloud platform. Because the target users are not 2C individual groups, they are not like ChatGPT is thus known to the general public.

Although many bigwigs in the industry have also made 三年之后 AI 将终结编程such remarks, I am relatively optimistic in my life. Even if one day AI really ends the vast majority of programmers and leaves only a very small number of algorithm engineers, then I will Make the most of the AI ​​to make myself stronger as much as possible before it kills me.

The reason why I have this relatively optimistic idea is that after using a series of AI products such as ChatGPT in the past few months, I found that my work and study efficiency have been further improved than before.

For programmers, everyone must be used to generating code through ChatGPT, and then manually adjust it by themselves, so that they can get runnable code in a very short time. In addition to this most routine operation, this article would like to share some examples of how the author uses AI tools such as ChatGPT to improve his work efficiency in his daily work.

Generate the corresponding unit test code for the code

The ChatGPT prompt used: 为下面这个<语言>实现的代码,编写对应的单元测试代码, and then feed the code to generate unit tests to ChatGPT:

insert image description here

ChatGPT will automatically generate unit test codes, and we can manually review and modify them on the basis of these.

insert image description here

Use ChatGPT to help yourself study the source code of classic frameworks

For example, I am an Angular developer, and I have to deal with the HttpClient tool library in its standard library almost every day.

Suppose I am interested in its request method and want to read its source code, but I don't quite understand the individual statements in it:

insert image description here

Then I first let ChatGPT introduce to me the whole request method to roughly accomplish one thing, using prompt:逐行介绍一下下面这个方法的用途。这个方法来自 Angular common 开发包的 HttpClient 实现 http.mjs.

insert image description here

The answer given by ChatGPT, I glanced at ten lines, and quickly understood the general purpose of this method.

insert image description here

Then send an instruction to ChatGPT to remind it to introduce line by line:我让你逐行介绍,你的介绍太简略了。

insert image description here

So I got the answer I expected.

Code refactoring and performance optimization

I first wrote a piece of ABAP code that had performance problems on purpose. This code first reads 200 Class definitions from the database table tadir, then loops through these 200 records, and reads the Class description information from another database table seoclasstx in the loop body again according to the Class name field in the definition.

REPORT z.

DATA: lt_dev  TYPE TABLE OF tadir,
      ls_dev  TYPE tadir,
      lv_text TYPE seoclasstx-descript.

SELECT * INTO TABLE lt_dev FROM tadir UP TO 200 ROWS WHERE object = 'CLAS' AND author
  = sy-uname.

LOOP AT lt_dev INTO ls_dev.
  SELECT SINGLE descript FROM seoclasstx INTO lv_text WHERE clsname = ls_dev-obj_name
     AND langu = sy-langu.

  WRITE:/ 'class name: ', ls_dev-obj_name, ' text:', lv_text.
ENDLOOP.

In total, the application server will cause 1 + 200 = 201 read operations to the database server.

I asked ChatGPT whether the above code can be optimized. In ChatGPT's reply, the first suggestion is very to the point: put the second SELECT statement outside the loop body:

insert image description here

I then issued a command to ChatGPT:请给我一份性能优化,重构后的代码。

ChatGPT also perfectly completed the task:

Bringing the second SELECT statement outside the loop now reduces the total number of database server reads from 201 to 2.
insert image description here

Having a headache reading regular expressions? Let ChatGPT read for us

The following two regular expressions are the regular expressions for verifying the legality of the username and password fields on the login page of the SAP e-commerce cloud front desk that I am in charge of:

export const EMAIL_PATTERN =
  /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // eslint-disable-line

export const PASSWORD_PATTERN =
  /^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[!@#$%^*()_\-+{};:.,]).{6,}$/;

insert image description here
insert image description here

To be honest, I can never remember these obscure regular expression grammars. Every time I need to use them, I just go to the grammar document temporarily.

With ChatGPT, I can directly let it tell me the design ideas of these regular expressions:

insert image description here

Use ChatGPT to help yourself get started in a relatively unfamiliar technical field

I have been developing with Angular for a while, and now I want to learn React, so I asked ChatGPT to suggest me some React learning points:

insert image description here

As a front-end developer who already has an Angular foundation, what I am most interested in is what is the biggest difference between Angular and React? I got some answers from ChatGPT.

Although I understand that ChatGPT's answer can only be used as a reference, at least it can give me a lot of inspiration and inspiration, and serve as a guide for me to go further to the React official website to start intensive reading and in-depth study.

insert image description here

The above are some tips on using ChatGPT to improve development efficiency in my daily work. Although Google search can also meet my needs to some extent, Google search requires me to carefully select keywords, and then manually filter out the pages that need to be read further from the search result list. And the interpretation of regular expressions in the above examples, automatic generation of unit test code, suggestions for code refactoring and performance optimization, at this stage, Google is still unable to complete the instructions I issued in an interactive way like ChatGPT.

Even if AI will eventually kill programmers one day in the future, until that day comes, I will always maintain a positive attitude and use AI to continuously improve my development efficiency.

Guess you like

Origin blog.csdn.net/i042416/article/details/130542507