lines
Jun 7, 2023

The Use of AI for Development and Debugging of React Native Apps

Joynal D’Souza, React Native Developer at League Gaming Pvt. Ltd, recently gave a talk at the React Native Meet-up on the effectiveness of using AI in development and debugging. This blog post presents the key takeaways from his talk.
Chayan
ChayanTechnical Content Writer

AI x Development - What’s the Fuss About?

What makes code great? Readability is a great answer. Code should be readable for all stakeholders who need to understand it. This fact makes code documentation vital for good collaboration. However, the majority of coders do not prioritize documentation.

The next yardstick for code quality is the scalability of the code. For example, for languages like JavaScript, a single-threaded language, if the code is not optimized enough, it may block the thread and slow down the app. Another is productivity amplification.

In this scenario, AI has emerged as the knight in shining armor. AI-powered tools can make documentation easier, reduce the time spent on writing repetitive code, and minimize the turnaround time of overall application development. For example, to write a simple checkbox component in React Native, it might take 10 minutes to write 50 lines of code. With ChatGPT, we can create a component with just one prompt.

But there is a catch. AI-generated code is not completely trustworthy.

This makes optimizing code vital for maintaining code quality. In the past, we had to think about how to optimize the function or code once it was functional. With AI, we can input our code and let it tell us how to improve our function or code. However, sometimes AI tools do not give accurate code. This means developers should evaluate all code to modify AI-generated code, if necessary, and we have to know the basics to write the code well enough or modify it to our advantage.

Legacies are Not Always Good, Especially in Coding

Overall, building new applications is becoming easier with ChatGPT. However, in the real world, we often have to work with legacy code written in React Native version 6.0 or 6.4.

Legacy code do be like

The entry of AI changes the status quo. Numerous optimizations are now available for React Native. However, companies usually do not want to spend too much time on upgrading and updating their applications.

But, as developers, we should still strive to use AI to optimize our functions more efficiently.

Debugging and AI

69542135859.png

Debugging is a time-consuming process. Finding a single line of code that does not work amongst multiple scrolls in the coding environment can sometimes feel like finding a needle in a haystack.

ChatGPT changed the process. However, the AI tool has made debugging code more complex. Oftentimes, developers need help understanding the code generated by ChatGPT. This makes it quite challenging to work with and hard to rewrite small chunks.

"We had some interns on our team who used ChatGPT for a simple blog application and found it quite easy to get the code they needed. But when we moved them onto a more complex project with legacy code, they needed help understanding what certain functions and components were doing. Therefore, learning the basics before using any AI tools is extremely important."

The Challenges of Using ChatGPT

While incorporating AI into the development workflow is inevitable. There is a long way for the process to evolve.

Screenshot 2023-06-05 at 5.29.14 PM (1).png

At the moment, there are multiple challenges that the tech community and other stakeholders are facing with AI-generated code. Some of them are:

  • Outdated versions of React Native (versions 0.6, 1.5, and 6.0) are currently being used. This means old libraries have to be used every time.
  • The code requires evaluation. This necessitates a developer adept at debugging in the team.
  • Package manager mismatches may occur, such as using React Native Animated version 1.0 but receiving the latest version from ChatGPT.
  • ChatGPT doesn't always have enough context to generate a perfect function.
  • Generating complex applications and debugging currently needs improvement with ChatGPT.
  • There is a 3000-character limit in ChatGPT.

Github Copilot, an extension to VS Code, seems to be a good solution. The tool has many more features in store for all enthusiasts. But it also needs to pass through the compiler test more for a conclusive observation.

Catch the full video below ⬇️

Hire our Development experts.