Okay AI, lets code

TodlyCodly
3 min readApr 17, 2024

--

Photo by jesse orrico on Unsplash

There are many articles how AI can help you code. But can AI help develop full app?

Is it:

  • Great
  • Useless
  • Another useful tool

Why?

Currently Internet is full of information how AI can help code. Except simple cases, I couldn’t find full project completed only AI assisted. Something more complex to check AI capability in real coding scenario.

Something to show is it more then hype.

What?

I am backend developer, I know my way around frontend but my skills are very limited.

I’ve decided to build whole Angular App with only AI assisted. No StackOverflow or Google. There were only 3 source of information I could use:

  • ChatGPT (most of time 3.5, but also 4)
  • GitHub Copilot
  • Official documentation of packages, once again no googling

The App

My application allow user to:

  • Define piping network using interactive diagrams (assume water flow)
  • Define boundary conditions using Angular forms
  • Numerical solver is written as npm module which is installed as dependency
  • Output of calculation is visible in app.

Working application demo (no CSS and beautifying)

The Good

Good news is that I managed to achieve all my objectives.

AI really helped

Photo by Pineapple Supply Co. on Unsplash

To get idea if my solver is stable I had to analyze previous calculations if there is any fluctuations. Without going into details. I needed:

Short circular buffer, which captures last N items.

AI came up with this idea:

Circular buffer

If I was reviewing this code during Pull Request, there would be nothing to comment. It is clean and it well divided into functions.

AI also kept attention to edge cases — nice.

The Bad

Part of my solver code required to:

Verify if consecutive items are monotonic

This what Github Copilot came up with:

isMonotonic implementation

This code has a lot of if statements and tricky array indexing.

Direction?

This variable called direction, is just a hack.

Does it work? Yes

Is it maintainable? No

In the end

It is very, weird situation. AI is like very, very good junior developer:

  • Always happy to help.
  • Good at searching for information.
  • Eager to solve any problem.
  • But..
  • Don’t have its own style.
  • Is not consistent.
  • Often provide solution which doesn’t work at all.

So in summary:

AI is great tool for those who, knows what they want to achieve.

AI is bad tool for those who, don’t know how to code and still needs to learn.

Happy coding!

--

--

TodlyCodly
TodlyCodly

Written by TodlyCodly

C# developer, who once was Pythonista and dreams of being Golang guy.

No responses yet