AI is fantastic, but don’t stop learning to code

AI is fantastic, but don’t stop learning to code

Have been using AI for a couple of my projects actively. Right now I use just vscode with Github copilot.

Here is how I am using it

  1. Describe my need in plain english
  2. Give it some code context if needed
  3. And ask it to generate code for my requirement

It really works like magic. Gives me a solid start and mostly the code is functional. I still need to go over it and tweak it a bit to work exactly the way I need it to most of the times.

I will say this. Anyone not using AI is probably missing out on a massive productivity boost.

But, it won’t build a fully functional and performant app for you, YET.

And this is where your knowledge comes into picture.

For instance, while working on my project, Co-pilot came up with this which has a N+1 query problem. I didn’t even notice it initially and only came to know when the screen was taking more than 10 seconds to load.

$trackersWithUptime = $trackers->map(function ($tracker) {
                $uptimeData = TrackerEvent::select(
                    DB::raw("DATE_TRUNC('day', start_time) as day"),
                    DB::raw("COUNT(CASE WHEN message = 'Success' THEN 1 END) as successful_requests"),
                    DB::raw("COUNT(*) as total_requests")
                )
                    ->where('tracker_id', $tracker->id)
                    ->whereNotNull('start_time')
                    ->groupBy(DB::raw("DATE_TRUNC('day', start_time)"))
                    ->get()
                    ->map(function ($item) {
                        return [
                            'day' => $item->day,
                            'uptime_percentage' => round(($item->successful_requests / $item->total_requests) * 100, 2),
                        ];
                    });

                // Add uptime data to the tracker
                $tracker->uptime = $uptimeData;
                return $tracker;
            });

So, by all means use AI to build whatever it is that you want to build but do take the time to learn to code. You will be a lot more at peace knowing you will know how to fix things when shit hits the fan.

Happy building!

Madhukar Prabhakara Avatar