The hottest tech new of last week is Copilot. Seems almost all programmers are playing or waiting for play with this new fancy AI coding assistant.
Someone says it will totally change the world of programming, an innovative and game-change one!
But, I am not so optimistic about it. From my perspective as an old-school programmer, this kind of tool looks fancy but not so helpful as people give credit for. Not to mention it will be a substitute for real programmers.
Let me explain it to you.
Coding faster is not a big deal
Think about it. How much time do you spend on coding?
In fact, the time we spend on writing code is not a high proportion of the overall software development cycle, even less than a quarter(especially in some tech giants).
We spend much more time on requirements analysis, technical design, testing, debugging, team collaboration.
Software engineering is hard, mostly because of the high complexity of the real world. We can’t change this in truth, abstractions in computing over time are inevitable. And no project ever failed with slow coding.
Coding faster will not make you a better programmer, instead, the ability of abstraction, design, and real experience of real-world engineering will make you a better programmer.
Some aged programmers typing slowly for bad eyesight, but they write bug-free code.
Will help on coding faster?
Years ago I was fascinated by this kind of programming aids. There is a popular template system in Emacs called snippets. We can define our own templates and functions, and then a shortcut would generate code template for me, and I’d just need to fill in the rest.
That looks cool, really cool…
It makes me like a movielike super programmer.
But after I got deep into it, it turns out not as useful as I thought.
tabnine is a similar AI tool with Copilot, which will generate part of the code based on your previous inputs. Copilot will even suggest based on you comments, name of function.
The problem is, when I’m coding with it, I need to constantly review whether the completion is right.
This is a kind of distraction for me. Imagine that, you are an experienced and solid programmer, this AI-tools is a naïve and occasional dumb one, he will pair coding with you.
No, I don’t want it!
The best practice to make programming faster is:
- focus, focus, and focus.
- Think clearly before coding
Shortcut, variable completion, class attribute, and method names completion are all helpful for coding faster, it will help your typing to catch up with thinking.
But code generation is a different thing. It will distract you, even more than 50% of the completion catches your coding intention, the other nonsense part will slow you down.
If the code base which contains a lot of repetitive pieces or logic, this kind of tool can definitely speed up your coding. Such as most front-end programming, web programming which contains lots of similar CRUD logic.
But I don’t believe this stuff will make a fundamental change to programming.
Will help on learning programming?
Copilot will help to reduce the duplicated tasks like search code from Web. As a beginner to learn programming, it may help you, since when you type some keywords, the code snippet will show up in front of you.
But, as a reminder, copy and make it work is not a better way to improve your coding ability or qualify of work.
Instance coding suggestion may make you happy when coding, but will not help you in long term.
Programming is a craft such as writing, we are writing source code to express ideas. Do you think it’s a good idea to let AI to assist a learner what the next sentence or paragraph will be?
Word completion will help, and sentence auto-completion will become a burden.
Same as writing, if we want to be better at programming, the only way is coding a lot and reading a lot.
John Carmack when talking about learning programming:
Avoid “cookbook programming”, where you copy and paste bits of code that you have found to make something work. Make sure you fully understand what everything it actually doing, and that you are comfortable applying the techniques in other situations.
The potential risks
There are several kinds of risk come with AI coding assistance:
Potential bug introduced in. If the user didn’t pay attention to review the generated code, it will be a nightmare.
The copyright and ownership issue of code. If a code snippet generated from GPL authorized code base and adapted by a commercial company. Whose fault? And who is the owner when the code is generated?
Security. Is it possible for hackers to train some code snippets intensively and induce attacking code to users?
The potential benefits
Of course, this tool may also give some benefits in some scenarios.
To make the tool more useful, we may trend to write more meaningful names and better documents.
Interview will be easier if we allowed to use it?
Make you not longly when programming, it will give you a sense that someone is always with you. Maybe feel better than a small yellow duck.
Top comments (1)
Does Copilot know about functional abstraction? Can it suggest and/or do refactoring? Or is it just a code generator?
(No, these questions shouldn't be taken too literally - just a starting point for discussion and general enlightenment.)