SSW Foursquare

Do you use ChatGPT to help you code?

Last updated by Tiago Araújo [SSW] over 1 year ago.See history

ChatGPT is an extremely useful tool for software developers as it has been trained to understand how code functions. It will provide an invaluable alternative to StackOverflow, being a great resource to help developers troubleshoot.

ChatGPT can be used for:

  • Detecting bugs in your code
  • Solving compile time or runtime errors
  • Generating code based on a text description
  • Explaining how a piece of code works
  • Translating code to a different language (e.g. Python code to C#)
  • Minimising generation of boilerplate (e.g. JSON to C# classes)
  • Helping automate the code refactoring process
  • Helping perform code reviews

Warning: Ensure you double check code integrity before deploying to production!

chatgpt code prompt
Figure: Asking ChatGPT to explain this code

chatgpt code response
Figure: ChatGPT explains the code

Try it yourself, copy and paste this into ChatGPT

What does this code do?
public async Task<IActionResult> MoveRight(string id)
		if (await _legalApiDbContext.ParaLefts.Where(a => a.ParaId == id).CountAsync() != 0)
			ParaLeft toDelete = _legalApiDbContext.ParaLefts.Where(para => para.ParaId == id).First();
			_legalApiDbContext.ParaRights.Add(new ParaRight { ParaId = id });
			await _legalApiDbContext.SaveChangesAsync();
			return Ok();
		} else
			return StatusCode(StatusCodes.Status404NotFound);
	catch (SqlException err)
		return StatusCode(StatusCodes.Status500InternalServerError);
We open source. Powered by GitHub