Hacker News new | ask | show | jobs
by panarky 855 days ago
It's funny you say that, because I just had a similar experience.

Front-end web development with HTML, CSS and JavaScript is not one of my strengths, so I've been trying to go back-and-forth with GPT-4 to get a working prototype.

Before asking GPT-4 to generate any code, I try to have a conversation to explore the pros and cons of various approaches. Is it better to put separate click events on every object, or listen for events at a higher level of the DOM? Is it better to use callbacks for this or async/await?

But GPT-4 rushes to write code before requirements are defined, and then it struggles to modify that code later after I've decided what approach to take. It forgets what it did before, provides partial results, alters variable names between chat turns, contradicts itself.

Just tried the same dialogues with Gemini Advanced and it's night-and-day better. It seems to remember contexts from 10+ conversation turns ago, it provides a more thorough rationale for its suggestions, doesn't prematurely spit out code, and keeps variable names constant throughout the dialogue.

After the approach and requirements are defined, it can then generate large blocks of code with intelligent modularization into separate functions, more similar to how I would write it by hand than what I get from GPT-4.

Gemini Advanced also seems to prefer the more modern ES6 coding style (arrow functions, destructuring, const/let variable declaration). GPT-4 defaults to the 15-year-old style (string concatenation for building strings instead of template literals, heavy use of var for variable declaration, function expressions instead of arrow functions, etc.). GPT-4 routinely mixes styles even when I explicitly request ES6.