General > General Technical Chat
Video: AI that generates code
Miyuki:
I see it as a great possible expansion to IntelliSense
It is already pretty smart in many cases when it suggests reasonable lines of code or nice templates to fill
Circlotron:
Deep city.
AndyBeez:
--- Quote from: tpowell1830 on June 16, 2022, 08:47:28 pm ---I tried again, same request and the code was shortened considerably by utilizing "switch" instead of all of "else if" statements. The third time it even included remarks as I asked, code below:
--- End quote ---
That third iteration is closer to what might be expected for the task. Correct use of ToLower() which alows users to MixCASE theIR iNpUTs. Extra point there for the junior programmer. I suspect the AI code generator is using some kind of generic model of what a program has to do given the problem, and then applies this method to the syntax of a language. Programmers tend to start with what a language can do, and then use that to solve the problem. Which is why two programmers can come out with three program solutions. Either way, both entities use some kind of decisioning tree.
I would be interesting to know what the AI does when you ask the code generator to "use enumerated values". In C# the output should read something like:
--- Code: ---enum colorCode {
black,
brown,
...etc..
white
}
# The CASE statment then is similar to
switch ( value.ToLower() ) {
case "black":
return colorCode.black;
break;
...
}
--- End code ---
Enumerations in C# support many methods, so it is possible to write the code without any conditional statements at all. Which is a limitation of the AI; there is a 'density' in good coding that only comes from experience. Maybe that's the Art Of Programming?
https://www.w3schools.com/cs/cs_enums.php if you're interested.
--- Quote from: Miyuki on June 17, 2022, 05:29:00 am ---I see it as a great possible expansion to IntelliSense
...
--- End quote ---
In my opinion, IntelliSense is why Visual Studio has the edge over all other IDEs. It would be cool-ISH to have a suggest code feature. Although you'll need to implement a team policy that prevents thoughtfull programmers getting usurped by the office's lazy code hacks.
tpowell1830:
Ok, so I decided to ask GPT-3 a beginner question in electronics:
"ME: which npn transistor would you use for a low wattage, class D audio amplifier?
GPT-3: There are a number of different types of NPN transistors that could be used for a low wattage, class D audio amplifier. Some of the more common types include the 2N3904 and the 2N2222."
Specific, but not terribly difficult. This tool could replace google for such questions, since the answers generally come from the internet, but one doesn't have to scroll through tons of answers as well as ads.
After playing with this for several days, I think that it is a useful tool, however, I have gotten erroneous or highly biased answers as well. But, no different than what you would find searching with google.
Miyuki:
--- Quote from: tpowell1830 on June 18, 2022, 05:26:31 pm ---...
Specific, but not terribly difficult. This tool could replace google for such questions, since the answers generally come from the internet, but one doesn't have to scroll through tons of answers as well as ads.
After playing with this for several days, I think that it is a useful tool, however, I have gotten erroneous or highly biased answers as well. But, no different than what you would find searching with google.
--- End quote ---
Just wait till the ads will be camouflaged as relevant answers with powerful AI
They want to show you as many ads as possible, getting your answer, in the end, is just a bait to attract you
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version