Techwondoe

3 Ways ChatGPT Improved Our Technical Efficiency.

ChatGPTBlog
March 22, 2023

If you're not living under a rock, you've probably heard of ChatGPT - the advanced AI language model developed by OpenAI. ChatGPT is designed to understand and generate human-like language, making it a powerful tool for businesses and researchers looking to improve their communication and productivity. With its ability to perform a variety of language tasks, ChatGPT is quickly becoming a game-changer in the field of natural language processing.

We at Techwondoe are always eager to explore new technologies, and ChatGPT was no exception. As one of the first 10 million users to sign up, we couldn't wait to start experimenting with this cutting-edge language model and see what it could do.

We've come a long way from fearing that AI would take over our jobs to realising its potential to make us better. After thoroughly assessing it for a couple of months, we've discovered the top 5 use cases for AI that we believe can enhance our productivity and efficiency.

As a technology-focused company, many of the use cases I'm about to mention will also be technology-related. However, they can be easily adapted for non-technology activities as well.

1. Asking for feedback

After writing a certain piece of code, and at times doubting its efficiency, I would send it to ChatGPT and ask “how can I make it better

e.g. let’s say I want to write a piece of code where I want to remove the first element from the array and print the remaining element

Disclaimer: I will never write code like this. This is purely for example purposes

Let’s say I wrote this piece of code for the above problem statement

const arr = [1, 2, 3, 4];
for (let i = 0; i < arr.length; i++) {
  if (i === 0) {
    arr.splice(i, 1);
  }
}
console.log(arr);

As you can see this is highly inefficient and could be written in a way better manner. So what I usually do is whenever I am in doubt, I send the code snippet to ChatGPT and ask it to tell me on how can I make it better.

Image 1

Now as you can see this not only made my code efficient it also made me understand the code as well.

2. Explain

As an outsourcing software company, we frequently work with existing codebases from our clients. We've seen both excellent and poor quality code, and it's a universal truth that developers find it challenging to comprehend code written by someone else. This is where ChatGPT can be a valuable resource.

e.g. Let’s say I have this code snippet

async findUsersBy(
  whereOptions: FindOptionsWhere<UserEntity>,
  includeRelations = true
): Promise<UserEntity[]> {
  const optionsKeys = Object.keys(whereOptions)?.join(', ');
  const optionsValues = Object.values(whereOptions)?.join(', ');
  this.logger.log(`Finding internal user by options [${optionsKeys}]: [${optionsValues}]`);

  // Build Relations and Where Options
  const options: FindOneOptions<UserEntity> = { where: whereOptions };
  if (includeRelations) {
    options.relations = {
      addresses: true,
      uniqueEmail: true,
    };
  }

  // Search for this specific user
  return await this.find(options);
}

Though this is very well written and quite self-explanatory as to what we are trying to do here, let’s give it to ChatGPT and see how well it explains

Image 2

See how easily it summarised and explained this back to us

3. Grunt Work

One way I leverage ChatGPT is by automating tedious tasks. As part of our coding practices, we prioritize adding sufficient JSDocs, Swagger API annotations, and logs in our code. However, this process can be time-consuming. ChatGPT helps streamline this process by assisting us in generating the necessary documentation and logs.

For e.g let’s say I have this Class

export class User {
  firstName!: string;
  lastName!: string;
  dob?: Date;
  phoneNumber?: string;
  email!: string;
}

and with just a simple message, I delegated most of the grunt work

Image 3

Conclusion

The possibilities of incorporating AI into your daily activities are endless. If you're from an engineering or technology background and haven't explored the potential of ChatGPT, I highly recommend trying out the use cases mentioned above. They serve as an excellent starting point for embarking on your journey with AI.

The rapid growth of technology in this space is a testament to its potential and longevity. The sooner you become acquainted with it, the better it will be for your growth and development.