Home >Web Front-end >JS Tutorial >NgSysV.The Age of AI - Meet your Digital Tutor
This post series is indexed at NgateSystems.com. You'll find a super-useful keyword search facility there too.
Last reviewed: Nov '24
When I first used chatGPT for advice on an IT issue in November 2022, I swear I felt the earth tilt on its axis. Whether this new "Age of AI" will be for good or for ill remains an open question but, for you as an IT learner, I'm clear that it represents an unparalleled opportunity.
Put simply, chatGPT gives you a personal tutor - a training "entity" that is available at the touch of a key at any time of night or day. It will provide general background information, debate issues, answer questions and resolve problems. And it's free!
Not the least of its capabilities is that it seems to have an almost uncanny ability to understand what you're asking. It is amazingly tolerant of poor grammar and spelling. Its (instantaneous) response is then clear and beautifully structured.
Previously, an IT student working independently of formal teaching would have had to fall back on Google searches. Certainly, the information you were looking for would exist somewhere in the blizzard of results returned by the search, but where and in what language? While most technical documentation is written in English, from the point of an IT learner unfamiliar with technical jargon, it might as well be written in Martian.
Now, in what must surely be the greatest IS ever devised, this vast mess of raw information has been sorted into a coherent form and front-ended with natural language tools. Exactly how it works is beyond my understanding. What I do know, is that, when I am struggling to understand an issue, chatGPT can save me months of frustrated floundering. I'm confident that it can do the same for you.
At the time of writing (November 2024), you have free access to three significant bots - chatGPT, Bing and Gemini. Of the three bots, ChatGPT is the one I recommend. I've been using its GPT40 version on its free tier and have found it perfectly adequate for my requirements. I'm conscious of the enormous debt I owe here to Open AI, the artificial intelligence research lab and company founded in 2015 by Elon Musk, Sam Altman, and others.
ChatGPT is distributed as a webapp, so no "installation" is required. I run it in Chrome on a laptop with a modestly-sized screen, a keyboard and a mouse. You can sign up at Chatbot App. Use your email to register an account and you're on your way.
Here are a few tips:
Here are some examples of specific questions you might ask:
ChatGPT's answers won't always be correct, especially when you get onto recent topics where its training opportunities will have been limited. Be prepared to do cross-checks using a search engine. In my experience, chatGPT is much more reliable than either Bing or Gemini, but it still gets things wrong. With experience, I think you'll find that you can somehow tell that it's "blagging" you. When challenged and presented with clear evidence that puts it clearly in the wrong it will respond with "I'm sorry about the confusion in my previous answer". That always makes my day!
I hope the two of you have a great time. ChatGPT will save you a ton of trouble.
Frankly, at this stage in your career, it would be best if you forgot about any serious use of AI code generation. You need to develop an instinct for good coding practice and this will only come through writing it yourself. But that said (and I'll be the first to admit that using an AI assistant to write console.log messages has saved me heaps of time), here are a few pointers.
If you're using VSCode as your code editor, the obvious AI assistant is Microsoft's Copilot tool. But be prepared to invest up to $100 per annum here.
Microsoft called their tool "Copilot" because a common practice in coding shops was for developers to work in pairs. A lead programmer would be assigned a "copilot" to do the "grunt" work. This worked really well - the leader would be free to concentrate on the tricky stuff and the copilot would learn basic skills from someone who knew what they were doing.
Once you feel you've learnt all the basic coding skills - naming conventions, composability, separation of concerns, "dry" (don't repeat yourself) and are a world-expert in Javascript syntax, etc, you may feel you're qualified to take a lead role. At this point, Copilot is magic! Here are a few notes about using it.
Copilot is installed as a VSCode "plugin". Plugins provide extensions to the editor's basic functionality. For example, the VSCode "Rewrap" plugin keeps my comment lines formatted within a fixed line length and saves me hours of cursing. They're usually free, being written by wonderful people who want to make other people's lives easier.
Instructions for installing Copilot can be found at Set up GitHub Copilot in VS Code. This will sign you up for a free trial, set up a payment method and add the extension to your VSCode installation. If you decide to continue, you can opt to pay monthly or take out an annual subscription at a reduced rate.
Right now, without any of this, you can get quite a lot of assistance from the basic "out of the box" VSCode.
For a start, a r-click/"format document" on your code will straighten out all the mangled indentation. Automatic syntax-checking will highlight missing brackets and identify undeclared variables (through the display of a mysterious "three-dot" annotation beneath a variable name).
Additionally, there are "IntelliSense" popups that appear as soon as you start typing a function or variable name. With luck, these will include an entry for exactly the name you intended to type. Clicking the entry saves you the bother.
But Copilot takes things into another dimension. Install a free Copilot extension and try typing a console.log command. Immediately you start to type the command a faint "preview" of Copilot's best guess at what you intend will appear. The difference between this and what you've seen with Intellisense is that Copilot has scanned all of the code before this point and has made an acute guess at what you intend to log. If it's got this right, which in my experience it does with alarming accuracy, all you have to do is click the "tab" key and observe the faint preview turn into solid text that becomes part of your code.
You will get a better insight into Copilot's abilities if you start typing a comment to describe the functionality of a block of code you plan to write. As soon as you start typing, Copilot will offer previews of what it guesses you're trying to do. We've all seen "autocompletion" before, but Copilot takes things into another dimension - it completes not only words but whole sentences. Again, it uses the context of your preceding code to propose both variable names and logic. I've seen it complete a full paragraph and even conclude this with a "This is a pain" comment, mimicking something I'd done in respect of a particularly tedious block of dull but essential code myself a few hundred lines previously. That made me laugh.
But when I completed my comment, I wasn't laughing when Copilot proposed a block of Javascript that implemented the actions described in the comment. The code was word-perfect!
are we seeing here? Man-machine symbiosis, an arrangement analogous to a horse and a rider? Remember, a horse without a rider is just an interesting animal.
You'll find a full description of Copilot's functionality at Microsoft's Getting started with GitHub Copilot in VS Code.
The above is the detailed content of NgSysV.The Age of AI - Meet your Digital Tutor. For more information, please follow other related articles on the PHP Chinese website!