A Programmer’s Perspective

Hello, fellow coders and curious minds! If you’ve ever found yourself deep in the coding trenches and wished for a trusty sidekick, today’s your lucky day. Grab a cup of coffee or your favourite energy drink, because we’re about to embark on a wild journey into the world of AI-powered programming with GitHub Copilot.
Now, if you’re not a developer or tech geek, you might be wondering, “What on earth is GitHub Copilot?” Picture this: you’re Tony Stark and you have JARVIS by your side, always ready to provide assistance with your coding needs. That’s GitHub Copilot for you.
Meet GitHub Copilot
Let me give you a little context before we dive in. GitHub Copilot is an AI-powered code assistant developed by GitHub and OpenAI. It’s like your super-smart pair programmer who “learns” from the billions of lines of code on the Internet and assists you in writing better code. Yes, folks, you heard it right. AI is now writing code and we’re living in the future.
So how did I, an experienced Laravel developer, come to dance with this cutting-edge technology? Well, it all started with my insatiable curiosity and slight skepticism.
A Dose of Skepticism
I’ve been in the tech industry for a long time and I’ve seen my fair share of trends come and go. Some were genuinely groundbreaking, while others… not so much. I’ve always been skeptical of things that promise to revolutionize the way we work. So when I first heard about GitHub Copilot, I was intrigued, but also a bit wary. Would it live up to the hype, or would it be another one of those fizzling tech fads? There was only one way to find out.
IDE Integration
Currently, GitHub Copilot is available as plugins for VSCode, Neovim, Visual Studio and Jetbrains products which happens to be one of the most popular IDEs out there. I would prefer Jetbrains since i used it for years.
Installing GitHub Copilot into Jetbrains is as easy as pie. You just need to search for “GitHub Copilot” in the plugins view and then click on install. Voila! Your AI coding assistant is ready for duty.
Once installed, GitHub Copilot springs into action as soon as you start writing code. It automatically suggests completions for the line of code you’re working on, appearing in a dropdown right under your cursor. It’s like having a pair programmer who’s always ready to jump in with a suggestion, except this pair programmer has been trained on billions of lines of code from across the internet.
That said, GitHub Copilot doesn’t replace the need for a solid understanding of coding principles and practices. It’s a tool to aid your development process, not a magic wand that will solve all your coding challenges. But when used effectively, it can be a powerful ally in your coding journey.
First Impression
My first impression of GitHub Copilot was one of surprise and amusement. Surprise at the seamless integration with PHPStorm (Jetbrain product) and amusement at the suggestions it was throwing my way. My first test was to see how well it could handle a Laravel project I was working on.
As I started typing, this AI pair programmer chimed in with code suggestions. It was like watching a kid trying to finish your sentences, sometimes accurately and sometimes hilariously off. The first few suggestions were simple ones, like filling in method names or completing loops. Not bad, Copilot, not bad.
Let’s set the stage for a Laravel-based example. Suppose I’m working on a Laravel controller and need to write a function that retrieves a user by their ID. Here’s how GitHub Copilot might assist:
// Before GitHub Copilot:
class UserService
{
public function getActiveUsers()
{
// I'm about to start typing here...
}
}As soon as I start typing the function content, GitHub Copilot springs into action and suggests the following:
// After GitHub Copilot:
class UserService
{
public function getActiveUsers()
{
return $this->user
->query()
->where('active', true)
->get();
}
}The AI has filled out the function, performing the user lookup using Laravel’s Eloquent ORM including the query filter.
This is an example of a successful and helpful suggestion by GitHub Copilot and it illustrates how the tool can make coding faster and more efficient. Of course, the actual suggestions will vary based on the specific code and context.
The Real Test
Impressed by the initial performance, I decided to put Copilot to the real test a complex feature implementation in my Laravel project. I must say, this is where the magic happened. I was writing a function to perform a multi-level data sorting operation and GitHub Copilot chimed in with some surprisingly accurate suggestions. There were a few missteps, but overall, it was like having a second set of eyes on my code, pointing out more efficient ways to accomplish tasks.
Facts and Figures
Now, let’s get a bit more serious and talk about the facts. According to GitHub, Copilot was trained on a variety of public repositories. It means it has learned from millions of developers before us. It’s like having the collected wisdom of the developer community at your fingertips, ready to assist you in your coding endeavors.
In my experience, GitHub Copilot offered relevant code suggestions about 70% of the time. The remaining 30% ranged from mildly off-target to hilariously incorrect. But remember, folks, this is an AI we’re talking about. It’s not perfect, but it’s a work in progress and it’s already quite impressive.
A New Age of Coding
What does GitHub Copilot mean for developers like us? Well, I believe we’re on the cusp of a new era in coding. With AI assistance, we can automate the mundane, focus on the creative aspects of coding and potentially reduce the time spent on bug fixes and troubleshooting. Copilot might not replace human developers, but it sure can make our lives easier.
If you’re a junior developer or a beginner, Copilot can be an excellent tool for learning. It’s like having a tutor who provides instant feedback as you code. For more seasoned developers, it can help increase productivity by reducing the time spent on boilerplate code and routine tasks.
The Future of GitHub Copilot 🚀
Despite some hilarious missteps, I believe GitHub Copilot has a promising future. As AI technology evolves and the system learns from more and more code, its suggestions are bound to improve. It’s not hard to imagine a future where AI plays a significant role in programming, making our work more efficient and enjoyable.
My Final Thoughts
As I wrap up this article, I can’t help but look back at my initial skepticism. Yes, I was skeptical but GitHub Copilot has won me over. It’s not perfect, but it’s a step in the right direction. It’s a fascinating tool that has the potential to change the way we code.
So, to all my fellow programmers out there, whether you’re a seasoned developer or a newbie just dipping your toes into the world of coding, I recommend giving GitHub Copilot a try. You might be surprised by how much you like having an AI sidekick.
And remember, even if it suggests Python code for your PHP problem, take it with a grain of salt and a dash of humor. After all, we’re all here to learn, grow and occasionally have a good laugh at the quirks of AI.
Until next time, happy coding!
A Quick Note
Just a quick note before I sign off. It’s important to remember that while GitHub Copilot is an excellent tool, it’s not a replacement for understanding the fundamentals of coding. It’s here to assist us, not do our jobs for us. So, always strive to understand the suggestions it makes and why it’s making them. That’s how you’ll grow as a developer, with or without an AI sidekick.
And with that, I bid you adieu. I hope this tale of my first encounter with GitHub Copilot was both informative and entertaining. Whether you’re a seasoned Laravel developer like me, a Tech lead or just someone interested in the evolving world of tech, I hope you found something of value in my story.
So, are you ready to give GitHub Copilot a whirl? I’d love to hear about your experiences and any funny or surprising suggestions it makes. Happy coding, my friends!