Revolution Of Coding Using AI

Revolution Of Coding Using AI

A revolution of coding is happening where an AI System is capable of helping coding. Yes I am talking about the powerful coding capabilities by OpenAI (GPT-3 Model) and GitHub Copilot. Let me share my experience how this GitHub Copilot is helping us and adding values to developers, organizations, and their clients. One should not compare this with googling, then copy paste. This system knows your code and logic.

AI as your pair programmer

Suppose I am an intermediate skilled developer in an open source say, React.Js or Node.Js technology and I am contributing in a complex application development. GitHub Copilot understands my application code and keeps on suggesting me several near accurate comments or codes so that I can autocomplete my code. Instead of coding I start writing human language instructions and let GitHub Copilot auto generate complete code for me based on the comments I wrote. You should be wondering how accurate the codes could be. It's amazing and I will share that soon. Please read till end.

There are plenty of open source frameworks and technologies and a developer might not be skilled in many of them. This AI based GitHub Copilot understands these open source frameworks and guides me the coding in the right direction based on my need. I would say even if a developer is intermediate skilled in the framework, still Copilot can help to achieve best quality coding.

AI To Code Unit Test

The most ignored part of software coding are Unit Testing and Integration Testing. Most of the time they are compromised with budget and timeline. There are also drawbacks, challenges and complexities associated with these testing. To add value, developer has to follow best practices like dependency mocking, collaboration testing, contract testing, implement positive and negative test scenarios, cover all scenarios, code coverage, branch coverage, etc. It needs experience and expertise to follow these best practices by developers. The effort for quality unit test coding is high. If I have to recommend a tool which can help coding unit test then I will recommend "GitHub Copilot". The AI helps me code complex mocking, unit testing, contract testing and also guides me to cover various scenarios which I had not thought of. It really increase productivity and quality of coding unit test.

How accurate the codes are?

As per my evaluation, initial codes are around 50% accurate. This means that I still have to be at least intermediate skilled developer in the tech stack. Few times, I have to correct some of the AI generated code to make it accurate in terms of syntax and functional. Then I found the AI System automatically learned my codes and improved all by itself. Next time I found that the accuracy has increased higher to 80% and above. In some cases it was 100% accurate.

What kind of human language best suite to instruct Open AI to let auto-generate code?

I have tried plain English sentence as comment and GitHub Copilot understands that. But I found using technical terms in the sentence to be more effective and increase accuracy. For example instead of just saying

"I want mocking of Kafkajs framework",

say "I want Jest mocking of Kafkajs framework".

Since I use the word "Jest", the AI System will generate 100% accurate mocking using Jest framework rather than end up in something else.

For Unit Test code generation by AI System, I again tried using "Gherkin" format of representing scenario and I found the accuracy is much higher than plain sentence. Almost 90% to 100% accurate code generated in my PoCs. An example of Gherkin format to comment a test scenario is below:

//given a message containing product object, when queueMessage is called, then kafka producer send should be called with topic='product-ms'        

And the AI System generates the Unit Test code below with 100% accuracy. You may not require to read the code given below. I am sharing it to give an idea.

it('should call kafka producer send with topic=\'product-ms\'', async () => 
? ? ? ? const message = {
? ? ? ? ? ? id: '1',
? ? ? ? ? ? name: 'product1',
? ? ? ? ? ? category: 'category1',
? ? ? ? };
? ? ? ? //when queueMessage is called
? ? ? ? await brokerService.queueMessage(message);
? ? ? ? let mockKafka = Kafka.mock.results[0].value;
? ? ? ? let mockProducer = mockKafka.producer.mock.results[0].value;
? ? ? ? //then kafka producer send should be called with topic='product-ms'
? ? ? ? expect(mockProducer.send).toBeCalledWith({ topic: 'product-ms', messages: [{ value: JSON.stringify(message) }] });
? ? });{        

One of the interesting discovery I made from this AI Pair Programmer:

I have discovered that GitHub Copilot is able to understand my instruction in plain English comment to modify an existing query or function. Interestingly it did accurately in some cases which I practiced. The existing query was a complex one with multiple joins, grouping and projection with aggregation.

What could be value additions with such AI System?

GitHub Copilot rightly mentioned "Your AI Pair Programmer". Definitely it is helping developers to great extend. It is also helping the organization and their clients by delivering better code, quality code, more unit testing, better documentation, productivity of development and testing. The impact will be optimization on overall delivery timeline, release timeline and maintenance overheads.

What coding languages GitHub Copilot supports?

As per documentation in their home page, these are languages supported: Python, JavaScript, TypeScript, Ruby, Java, and Go, but it understands dozens of languages and can help you find your way around almost anything.

What have I tried?

This is a continuous exploration and I will keep on updating. Below are the tech stack I have explored and found great support. I might come up with a list along with ratings.

  • Node.Js + Express.Js development
  • SQL
  • Jest unit test development using Gherkin documentation of test scenarios
  • Mocking of dependencies, collaboration testing and contract testing
  • React.Js Component development, HTML, Javascript, CSS
  • Angular development
  • API Design YAML with Open API Design Specs (OAS 2,0 and 3.0)
  • Arduino development
  • AWS Lambda development

Thanks for reading my blog. I will keep updating with more findings or innovations. If you are a developer, signup with GitHub Copilot and be on waitlist until Microsoft permits you. Enjoy GitHub Copilot! You are the Pilot!

Chingangbam Irabanta

Skills Transformation Leader| GenAI | AI | Architect | Product Engineering Expert | Estimations & Planning Expert | Agile Delivery Expert.

3 年

I have updated my blog to introduce another capability observation. AI Pair Programmer was able to make changes in existing queries to incorporate new requirement. In my experiment, I can't believe it.

回复
Chingangbam Irabanta

Skills Transformation Leader| GenAI | AI | Architect | Product Engineering Expert | Estimations & Planning Expert | Agile Delivery Expert.

3 年

Demonstrations were given in today's tech talk. Would love to hear more thoughts.

回复
Arpan Tongbram

National Consultant-IT, Ministry of Health and Family welfare(NACO)

3 年

This will change the future

Chingangbam Irabanta

Skills Transformation Leader| GenAI | AI | Architect | Product Engineering Expert | Estimations & Planning Expert | Agile Delivery Expert.

3 年

Yesterday I coded Arduino in platformio IDE and GitHub copilot gave the same response to generate the codes i wanted.

回复
Vasu Puvvada

AVP-Technology @ Celsior Tech | Curious Technology Thought Leader Delivering World-class Innovative Solutions & Experiences With Empowered Teams

3 年

Hey Chingangbam Irabanta, thanks for sharing the experience... this is going to be a game changer and helps in producing better quality by everyone... Thanks again!!

要查看或添加评论,请登录

Chingangbam Irabanta的更多文章

社区洞察

其他会员也浏览了