Do you use ChatGPT to help you code?
Loading last updated info...
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!
Figure: Asking ChatGPT to explain this code
Figure: ChatGPT explains the code
Try it yourself, copy and paste this into ChatGPT
What does this code do?[HttpPut("{id}")]public async Task<IActionResult> MoveRight(string id){try{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 });_legalApiDbContext.ParaLefts.Remove(toDelete);await _legalApiDbContext.SaveChangesAsync();return Ok();} else{return StatusCode(StatusCodes.Status404NotFound);}}catch (SqlException err){_logger.LogError(err.Message);return StatusCode(StatusCodes.Status500InternalServerError);}}