![]() When I open a new file and start writing fresh code, it will most likely forget the suggestion rules from the previous file. It does read and remember the code written previously in a class or a method, and will (eventually) adapt and follow my lead, but that's only for that particular file I'm editing at the moment. Neural network behind Copilot is trained on numerous lines of code using getters - and it will almost exclusively suggest getters over direct property access. In my case, that's refactoring old value objects to use constructor property promotion and eliminating getters. The most obvious fail point is based on the architecture of any ML application today - it's trained on the existing data and will suggest solutions which are the most common for a particular situation. The same goes for value objects, factories, adapters. For example, include "DataProvider" in the name of a class or trait and it will start suggesting code ideal for use in PHPUnit's data providers (especially if your other data providers follow the same architecture and naming patterns). Following a standard for naming classes and methods and using descriptive names can also help significantly, since it's based on a natural language model and can (in some form) "understand" the context and purpose of the code based on names. If your code follows a certain architecture and is using design patterns extensively, Copilot really shines. But, sometimes - it just works perfectly. The worst part is that it gradually tries to mix the new code with the old one, which does create a solid amount of mess. In addition to this, it will almost certainly skip suggesting empty string or array initialization, even if the old code has it and even if it makes perfect sense in the code. That's fine if I just want to rewrite something and make minimum adjustments (like renaming properties, variables, methods.), but if I really want to refactor and improve the code, Copilot simply gets in my way with suggestions based on the old code - and it keeps doing it so aggressively that I simply want to disable it until I'm done refactoring. However, this is a double-edged sword, since it will force suggestions based on the old code. For example, if I have two projects opened and trying to rewrite some old code, it will start offering code suggestions based on the currently opened file (tab) of the other project. I can simply feel this being used extensively. If you take a look at Terms of service, you might notice that you're giving the right to Copilot to read and analyze the code of your project and any open tab in your IDE. Refactoring and rewriting existing code is one of the stronger points of Copilot. Generated comments are more like good and useful guidelines. It can be 100% accurate for a complex code, but fail on more simple one (and vice versa). ![]() It's important to note that the accuracy of the generated comment does not depend on the size or complexity of the code. About 80%-90% of the time it is, but there are cases where it can generate a misleading comment which would make more damage than help if left unchecked. Copilot's suggestions in this case are OK and mostly true, but I do need to read and try to understand the exact meaning of the generated comment, then run through the code and see if the suggestion was right. I only need to open a comment on top of the code, or start a new docblock comment line, and the suggested description is generated. There are parts of the code which I remember being exceptionally complex to write and optimize, which inevitably produced code which is difficult to understand now, 2 years from the time the code was written. I am in the process of revisiting and refactoring some old PHP 7.4 code to PHP 8.2, along with the upgrade of Symfony and PHPUnit. The first thing which Copilot does good is writing comments for the already existing code. You can simply feel the architecture behind the AI in every single code or comment suggestion it makes. It does many things good (or good enough), but not great. So, the question for each subscription service is - is it worth it? Here are my impressions which you may find useful.įirst of all, let's set something straight - whatever Copilot can do, it can't be classified as great. When you add subscriptions which are not work related, it can become a bit overwhelming. ![]() ![]() priced at about $10 to $25 a month, the costs quickly pile up. While the price tag isn't anything special ($10 a month or $100 a year), when you consider the fact that there are many tools, services, IDE plugins. After the initial promo year of free access, GitHub released a commercial version of Copilot a while ago. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |