ChatGPT Changed How I Write Software
Tags: ai, chatgpt
Published: 2023-05-31 12:48:14


AI is buzzing right now. All my social media feeds are about some new thing you can do with ChatGPT plugins or showing off a new photo created by generative AI. I'll be honest, it's pretty cool to see and I'm not mad about it. 

The tech community seems to have gone on all-in on this AI gold rush. With new software, features, and enhancements popping up every day we have quickly found ourselves in a "sink or swim" moment. Do we embrace all the new advancements and see how development changes? Do we ignore it and hope it goes away? What about something in the middle?

![Chart of the adoption bell curve](https://readysetcloud.s3.amazonaws.com/ai_in_tech_1.jpg)
*Photo by [Jurgen Appelo](https://www.flickr.com/photos/jurgenappelo/5201275209)*

If we look at the adoption bell curve for AI above, I'd estimate we're still somewhat at the beginning of the early adopter phase. Lots of people are making noise about it online, but not many of us are actually using it in production. 

That said, AI's time will come when it's commonplace to see it in everything. It's not something we'll specifically notice, it will be assumed to be there and make software more delightful. 

Not for me, though. I've gone full swing into it and it's taken over how I plan, design, and implement software. Granted, [I'm not an enterprise architect anymore](https://dev.to/aws-heroes/growing-your-career-in-the-evolving-tech-field-3de), but I do run my website Ready, Set, Cloud by myself, and it has [a ton of software and services](https://dev.to/aws-heroes/building-a-serverless-post-scheduler-for-static-websites-4ci3) behind it that automate everything.

I wanted to share how I approach application design now that I have incredibly powerful AI at my fingertips.

## A Quick Foreword

Before I go any further, we need to talk about a fallacy I've seen too many times drive technical and design decisions (and end up steering them away from innovation).

> There is no such thing as perfect software. The sooner you settle for "close enough" the sooner you and your customers will be happy.

Don't go into any design assuming you're building the perfect software. Even if you designed it "perfectly", when you go to implement it you'll [go through several iterations](https://dev.to/aws-builders/starting-over-with-purpose-my-serverless-adventure-11a3) that end up changing it completely.

It's impossible to make everybody happy. People don't need "perfect software." They need something that *gets the problem done*. 

With that in mind, I know AI isn't perfect. It has hiccups. It might throw me a curveball every now and then. *That's fine*. If I can solve a problem in a new innovative way that's right 80% of the time, I've positioned myself for success.

Now that we have that out of the way, let's talk about some new possibilities we have with the rapidly increasing availability of AI.

## New Possibilities

ChatGPT and other generative AI services out there have impressive pseudo-human capabilities. Questions that you'd normally have to prompt a human for can typically be answered by AI. If you're willing to accept the answers given by these services (*and that's a big IF*), you open the door to many more possibilities that would have required human interaction before.

### Data Transformations

I wanted to create social media posts for my blogs when I publish them. I always do this manually but if given the chance, I would totally hand it off to a virtual assistant. I have the data from my blog post, but what I don't have are the keywords, structure, and formatting that my target audience likes. I have a rough idea since I've been doing it for a while, but I'm never perfect.

That said, ChatGPT can do it. It knows how to extrapolate information from my post and convert it specifically for a target audience. It has phenomenal information on market segments, and all I need to do to transform my data for a specific audience is just ask.

"Create a Tweet about my content targeted at serverless developers based in the United States." 

If I wanted to target something else, I could ask it for a different variant, like "Create a LinkedIn post in Spanish from my blog post targeted at .NET engineers in Spain."

The response can simply be dropped into the Twitter API and sent along its way. 

### Data Generation 

This is probably the obvious one we already know. Give ChatGPT a prompt and have it generate data, an email, or a pdf of something. But it has such a wide range of use cases it's worth stating the obvious.

I've blogged about [how I built a fitness app](https://dev.to/aws-heroes/my-chatgpt-workout-generator-just-got-better-5gnn) that generates workouts for me every day. I have a Lambda function that randomly decides which muscle group and gym equipment to use that day, and it creates a prompt to feed to ChatGPT. Then ChatGPT comes up with the entire workout, warmup, and cooldown for me to save to a database.

Prior to generative AI, this implementation would have been a nightmare. I would have needed some sort of database of exercises and ways to modify them for different types of workouts. Then I would have needed to come up with the logic that could modify them to pseudo-randomize and structure workouts. It would have been a multi-week build for subpar results. 

Instead, I spent 3 hours and built a Step Function workflow that queries ChatGPT and does all the heavy lifting for me (pun intended). I saved weeks of time leaning into AI instead of building something myself.

It doesn't stop at workouts, you could [generate stories](https://aws.amazon.com/blogs/compute/implementing-an-event-driven-serverless-story-generation-application-with-chatgpt-and-dall-e/), build entire mock datasets from a provided schema, or come up with recipes with the food you have in your kitchen. 

But now, I can have meaningful data generated for me automatically with the right prompt. I go from "software engineering" to "prompt engineering". You no longer need these massive databases of elements to feed custom business logic. Simply ask an LLM to use what it knows.

### Finding the Right Time

Knowing when the right time to post content, react to an event, or send a notification is extremely difficult. Ideal times generally vary on a case-by-case basis and rarely fall into a generic configuration. A good example would be notifying on-call engineers when an anomaly is detected. You don't want to notify on everything that pops up as it could introduce [alert fatigue](https://www.atlassian.com/incident-management/on-call/alert-fatigue).

If you routinely pass in a dataset to AI, it can identify anomalies and watch to see if it settles or even reason why the anomaly occurred in the first place. You can provide the AI some guidelines to only alert when something needs attention if it meets a certain set of criteria. This ultimately increases the effectiveness of your on-call crew and lowers your TCO purely based on manpower.

You can also pass JSON objects to ChatGPT and ask for JSON in return. Let's work through another example: *employee notifications*. 

With many people working from home nowadays, it's impossible to generically send a message at a time that works for everyone. So you could use ChatGPT to identify activity trends of an individual to get a statistically high likelihood of reaching them online. Imagine this audit history:

```
[
  {
    "timestamp": "2023-05-26T14:52:21Z",
    "event": "login"
  },
  {
    "timestamp": "2023-05-27T16:40:09Z",
    "event": "logout"
  },
  {
    "timestamp": "2023-05-28T07:55:13Z",
    "event": "login"
  },
  {
    "timestamp": "2023-05-28T19:30:10Z",
    "event": "logout"
  }
  // more audit events
]
```

You can feed the audit history to ChatGPT, then provide it a prompt of:

> Return a json object with a "sendAtTime" property in ISO-8601 format that has the highest likelihood of reaching the person the next time they are online.

This results in a response of:

```
{
  "sendAtTime": "2023-05-29T15:20:55Z"
}
```

And you didn't have to build an entire notification system! You pass in an audit history and ask generative AI to find the next time they will be online based on trends. It's just so fast to build things that previously took weeks of careful time, planning, and effort. Now you can build a Step Function workflow that loads audit history, hits a [Lambda function to query ChatGPT](https://dev.to/aws-heroes/the-serverless-toolbox-tools-to-build-serverless-apps-easier-1g5j), then set up a one-time EventBridge schedule.

## How This Changes Development

With all the examples we looked at before, a whole new set of use cases have unlocked. I no longer focus on building mundane systems that track CRUD operations. We have hundreds of examples that do that. 

Instead, I now approach software with eye toward artificial reasoning. What can I ask ChatGPT that will take the most code out of my hands? I've gone on record a few times stating that [code is a liability](https://dev.to/aws-heroes/skip-the-lambda-function-connect-directly-to-your-aws-services-3a3e). Any opportunity I have to take away code, I do it. This used to be in the way of directly connecting API Gateway to different AWS services. I would remove Lambda function code by skipping it altogether. 

But now, I might not even need an endpoint to do what I want. Things can just... happen.

I approach development from a stance of "*what can I automate, where can I gather insights, and when should I act*" when data is created. Let's take my blog as an example. 

All my posts are saved as Markdown files in GitHub. When I push a new article to the `main` branch, a slew of activities occur:

* [Cross-post the content](https://dev.to/aws-heroes/i-built-a-serverless-app-to-cross-post-my-blogs-3eoe) on other blogging platforms
* Summarize and gather analytics on the article details
* Synthesize a text-to-speech recording and save it back to the article
* [Create writer analytics](https://dev.to/aws-heroes/level-up-your-blog-with-writer-analytics-and-text-to-speech-21i3) (writing skill level, tone, expertise in area, topics)
* Identify target and tangental audiences based on the content
* Write social media posts targeting identified audiences summarizing the article content
* Schedule social media posts to go out at optimal times given the target audiences

Now, some of this doesn't exist yet - but it will thanks to generative AI. If you look at some of the actions that happen, ChatGPT is basically becoming an automated marketing team. Identifying the people a post would resonate with most, knowing how to reach out to them, and sending them tailored messages when they're online are all marketing tasks - and hard ones at that!

But because of the new way I've started approaching software development, this is all possible. I'm not looking into "how can I build a system that does X, Y, or Z", I'm figuring out what I need to ask AI to do it for me. 

It truly is a game-changer and all things considered, a [dirt-cheap option](https://openai.com/pricing#language-models) when it comes to ROI. Yes, the answers aren't always perfect, but I'm ok with that. If I'm being honest, it's never perfect when I build a solution by hand. But I've accelerated my time to completion by 100x, and that's worth every penny.

Happy coding!