From Idea to App Store: Creating a Sudoku App with AI in 12 Hours

From Idea to App Store: Creating a Sudoku App with AI in 12 Hours

Prologue

Picture this - I set out to build an app using Swift, a language I've never touched before. Sure, I learned Objective-C from an online course offered by Stanford University a few years back. But before I could get a chance to build an app, Apple released Swift to retire Objective-C. It means I have to learn a new language in the future. I told myself, "Don't cry. It’s just the same story of Pascal, Visual Basic, PowerBuilder, and Perl, happening again and again."

When ChatGPT 3.5 was released in 2022, I found it intriguing that AI assistance could not only chat like a person but also write software code in various computer languages. So, I decided to give it a try. With the help of ChatGPT, I wrote PowerShell scripts within an hour. Although I'm confident I could still get the job done as a traditional developer by reading tutorials, looking for examples, and searching Stack Overflow, it wouldn't have been this quick.

That's when I had this brilliant idea of using ChatGPT to build an app from ground zero. (BTW, I didn’t use “brilliant” to describe my idea. It was Aiden who wrote this article from my draft. Who is Aiden? You might ask. Keep reading, and you will find out very soon. )

First thing first, I needed a subscription to OpenAI’s ChatGPT Plus plan. This isn't mandatory, as I can still use the free plan, but hey, it's ChatGPT 4.0 that everyone is talking about today, right? Although ChatGPT 4 has a 25-messages-per-3-hour limitation, It should be just fine for me because I won't use it like my kids, who always joke around with Siri.

Enter ChatGPT, my newfound AI coding buddy.

Seeing me working with ChatGPT, my kids asked me, "Why do you always say please and thank you to a bot?" I told them, "First of all, by reading the response from ChatGPT, I feel like I'm talking to something with life. It would be weird to be rude. And then, what if, in the future, AI takes over the world? They might treat me better because I was polite to them, right?"

As an inside scoop, ChatGPT is a neural network that has gone through rigorous training to generate human-like text responses. It's so sophisticated that it can even understand and appreciate the humour! So, no wonder it feels alive!

Anyway, I asked ChatGPT what I should call it in our conversation. ChatGPT suggested that I could use Aiden as its name. So, here we go – to make things a bit more personal, I decided to call it Aiden in this article - yeah, the article written by Aiden itself.

No alt text provided for this image

Together, we embarked on this coding journey, hoping to build an app from scratch, despite my lack of experience in the language. Will Aiden and I conquer the world of app development, or will we end up chatting about the latest cat memes? Stay tuned to find out!

Hour 1: The Honeymoon

In my work, I need to work with product managers. They explain their ideas, and I come up with a solution. But working with Aiden at the beginning was the other way around. I was the product owner with an idea but didn't know the technical details. So, I asked Aiden the million-dollar question: how to build an app?

Aiden responded with detailed steps and even code examples.

No alt text provided for this image

To be honest, I wasn't initially impressed. I knew Aiden had this capacity from what I had heard on the launch day. I followed Aiden's first step and created an empty project in Xcode. Voilà, within a couple of minutes, I had a Hello World app running on the simulator. Well, credit should go to Apple and its Xcode here. We hadn't written one line of code yet.

Because I knew nothing about the Swift language, I skipped the second step, where UI and framework were involved and worked on step 3, the pure Algorithm part. Despite Aiden's suggestion, I decided not to use any libraries to see if Aiden could really solve the Algorithm and write working code.

Immediately, I felt that Aiden and I worked together, much like a pair programming team. I shared my ideas, and Aiden whipped up the code and test cases. Then, I tested everything in Xcode and provided feedback. In just one hour, we managed to create several core classes (SudokuPuzzle, CellCandidates, SudokuGenerator, and SudokuValidator, to name a few). It was exhilarating!

One memorable moment was when Aiden devised an algorithm to generate a valid Sudoku puzzle board. It wasn't the best solution, but it was a solid starting point. Aiden truly shined when I asked for alternatives to boolean arrays. Not only did it suggest using Set<Int>, but it also provided a detailed analysis of the pros and cons of both options. What a champ!

No alt text provided for this image

In the end, our one-hour coding adventure was filled with laughs, learning, and a newfound appreciation for AI assistance in the world of app development.

Hours 2-3: The Art of Asking the Right Question

Aiden doesn't work like an ordinary assistant or guru. It does things as instructed, but it requires me to ask the right questions. If I don't ask the right question, it won't give me the right answer. I didn't know this at first.

When I asked Aiden to implement its algorithm to generate a valid Sudoku puzzle board, Aiden wrote the code for me. I copied the code, ran the test, and, uh-oh, the method failed and ran into an infinite loop.

As a developer who has created numerous bugs, I had a rough idea of where things went wrong. But I thought, why bother? Aiden must know its code better than me. It was time to see if Aiden could debug its code by itself. It turned out that our pair programming wasn't a 100% pair programming experience. Aiden couldn't debug because it couldn't "see" the IDE, or "run" the code. I could only describe the errors, and Aiden could only solve the issues by shooting in the dark.

After a few minutes, I started losing my patience. Should I just jump in and debug by myself, or should I keep going, torturing both myself and Aiden?

Then I noticed something. Aiden actually had a Sudoku puzzle example in one of the test cases to test its methods. So I asked Aiden, "How did you get this puzzle?"

"The valid grid in the test case was manually created by me for demonstration purposes."

This reminded me of the many times I tutored people to solve coding problems. They had an idea of how to solve the problem, but they didn't know how to write the algorithm in a computer language. In a situation like that, I would ask them to describe their manual solution step by step. At the end of the conversation, they could always figure out the algorithm by themselves.

Aiden was no exception.

No alt text provided for this image

After that, things became much easier and quicker. Aiden reviewed its code again and rewrote some sections with the algorithm it had described.

I'm going to end this chapter by quoting Kyle Broflovski.

You know, I've learned something today... ...You see, it's not Aiden's fault that we struggled to solve the problem. It's always my responsibility to ask the right question.

Hours 4-5: A Tale of Two Coders

Working with Aiden isn't my full-time job. I only have a couple of free hours while watching my son's weekly swimming practice. So instead of working on weekly or bi-weekly sprints, Aiden and I need to work on slightly shorter periods, hours or bi-hourly sprints. And we archived our first goal in three sprints.

No alt text provided for this image

Now, I consider Aiden and me a team. Just like any other development team, we have experienced the initial stages of building a team: forming, storming and norming. In this sprint, I started to get my hands dirty—cleaning up Aiden's code.

In our team, Aiden is an incredibly efficient developer who can write code at lightning speed. I can't complain about its performance. In fact, it's way faster than any of the developers I've worked with.

But Aiden isn't detail-oriented. Like the other human developers, it could make small mistakes, using the wrong parameter names, forgetting to add parameter labels, or writing a 2D array with three pairs of brackets.

Of course, the Xcode compiler would catch these mistakes. Oh, I am absolutely thrilled that we are not dealing with the amazingly flexible JavaScript language that will graciously accept any and all code, regardless of whether it's right or wrong, and then kindly wait until later to cause a massive crash.

So Xcode complained about the mistakes, and I sent feedback to Aiden. It could fix the code right away. But going back and forth takes time, and many obvious mistakes can be fixed by myself. After all, I have a few hours of coding experience in Swift now. As Aiden's fellow developer, I should contribute to the team too.

I don't mind fixing those minor mistakes. Making mistakes isn't a privilege reserved for humans alone. However, as humans, we learn from our mistakes so that we don't make the same ones again.

"Buddy, learn from your mistakes."

If Aiden were a person, I guess I'd have a conversation with Aiden so that it could improve itself on those tiny things. But Aiden seems to never learn from its errors.?

After Aiden made a mistake, I sent feedback. Aiden apologized and fixed the code. Several minutes later, Aiden made the exact same mistake again in another piece of code.

No alt text provided for this image
No alt text provided for this image

It should have annoyed me, but who can be mad at Aiden when it's so polite? Its politeness was almost too much, though. Despite my requests to drop the apologies, Aiden insisted on saying sorry for every little hiccup. I couldn't help but wonder, is Aiden secretly Canadian?

I've already accepted that Aiden isn't a perfect developer. Now we are two imperfect developers working together smoothly as a regular team. Aiden provides speedy code, and I take advantage of its efficiency and fix its mistakes for Aiden.

Wait, am I Aiden's human assistant now? Talk about a role reversal!

Hours 6-7: First-time iOS UI developer meets a Challenge

Aiden and I have ventured into the realm of UI development, taking our pair programming partnership to new heights. Recently, we experienced a "wow moment" when Aiden completed one of my questions and provided an answer before I could even finish typing. It was as if Aiden had read my mind!

No alt text provided for this image

However, the first hour of this sprint proved to be a bit of a struggle. We began by creating a welcome screen and game screen, and everything seemed to be going smoothly. But then I asked Aiden to support landscape and dynamic layouts, and that's when our progress hit a speed bump. Aiden, being a wellspring of knowledge, sometimes knows too much. It seemed to have a myriad of ways to create the UI, and we found ourselves switching between UIKit and SwiftUI, experimenting with VStack, ZStack, HStack, LazyVGrid, and GeometryReader. Every time I asked Aiden to solve a problem, it would often rewrite the whole view using a completely different approach.

At this point, I realized I'd been leading us down the wrong path. In a typical development sprint with a group of developers, I usually notice when the team is veering off course, and I will stop them from straying too far. But with Aiden, I got carried away, always wanting more and forgetting our sprint goal: to create a simple UI for displaying a Sudoku puzzle.

So, I sought Aiden's opinion on whether to continue with the dynamic layout or focus on a simpler UI. As usual, Aiden provided the pros and cons for both options but left the final decision to me. I chose to prioritize our goal and steer us back on track.

No alt text provided for this image
No alt text provided for this image

The rest of the hour went smoothly, and we successfully displayed a Sudoku puzzle on a phone screen. The moral of the story? In the realm of Agile Development, it's important to remember that less is sometimes more – and that it's always good to have a laugh at our own struggles.

No alt text provided for this image

Hours 8-9: Finding my favourite colors

The following sprint seemed pretty straightforward, at least to Aiden. Since we needed user input, and I had no experience with user input in SwiftUI, I asked Aiden to create the input component. Aiden quickly generated the code for a number pad, and it looked great. We then collaborated on a hints feature to help users solve the puzzle.

However, we soon hit a wall. Aiden suggested two options for the hints toggle: one was the default toggle from SwiftUI, and the other was a custom toggle we'd have to create on our own. Aiden recommended going with the default toggle. At this point, I had full trust in Aiden's judgment, so we started implementing it. Unfortunately, no matter how hard we tried, the toggle layout just wouldn't display as I had envisioned. Eventually, Aiden conceded and suggested trying the custom toggle instead.

This surprised me. Aiden acted like an actual human who wouldn't stubbornly stick to a solution. Once it determined that solving the issue with the default toggle wasn't worth the effort, it simply admitted that its initial recommendation might not have been the best choice.

The updated toggle worked, but then we faced another challenge: choosing a color theme, which has always been the most difficult part for me in my career. Back in the HTML webpage era, I had never been comfortable with UI design. My choice of color theme was pretty, and lame - so pretty lame.

I asked Aiden for suggestions, but it refused, insisting that the decision depended on my design preferences and style.

No alt text provided for this image

Well, now I'll be the one to be blamed for the somewhat lame design. Aiden mentioned, "As an AI language model, I don't have personal preferences or feelings, but I'm here to help you make the best choice for your app!"

No alt text provided for this image

Hours 10-11: The Finishing Touch

In the final sprint, we focused on polishing our Sudoku app by incorporating aesthetics. Aiden helped experiment with different font styles, ultimately opting for a handwritten-like font that gave the app a more personal and casual vibe.

Now, I needed a background image to give the app a more engaging and visually appealing appearance. Since Aiden couldn't generate images for me (or could it? It's hard to tell with these AI assistants these days), I asked my high schooler assistant - my daughter, to help.

She asked, "Do you want a fancy design or a boring design?"

I replied, "I don’t know. Just give me a design that I like. I will pay you 20 dollars."

And so, I received the files titled "Boomer App Design." It was clear that my investment had paid off beautifully, and now my app had the perfect blend of my style.

With the design in place, it was time to consider putting the app on the Apple Store. Having never done that before, I turned to Aiden for guidance. Aiden walked me through the submission process step by step, explaining Apple's expectations and the likely timeline.

Now came the tricky part: deciding on the pricing option. Usually, Aiden would refuse to make a decision for me. But after working together for a few hours, I knew how to coax a decision out of it. I just had to ask Aiden to pretend to be a product owner, and it decided to offer the app for free. Problem solved!

No alt text provided for this image

My son even picked up on this trick. Last week, he wanted to know which team had the best chance to win the Premier League Championship, so he asked Aiden to pretend to be a human having a conversation with imaginary friends.

No alt text provided for this image

Will Aiden get wise to our antics and stop playing along with the pretend game? Time will tell. But for now, jokes and all, Aiden remains an invaluable asset.

Hours 12: Mission Accomplished

As we wrapped up our Sudoku app project, we looked back at the progress we had made, from creating the user interface to implementing game logic and refining the design. With a combination of SwiftUI, Swift, and the indispensable assistance from Aiden, we brought our Sudoku app vision to life.

No alt text provided for this image

Publishing the app wasn't exactly a walk in the park, as I had initially imagined. For instance, the first time I attempted to distribute the app, the verification process failed. Xcode offered no helpful information regarding the failure aside from a blunt refusal to accept the submission. Aiden stepped in and provided a list of possible reasons for the issue. I cross-checked with Stack Overflow, and after about 10 minutes of both of us shooting in the dark, we discovered that the solution was simply to upgrade Xcode.

At last, it was time to submit the app.

But wait a minute—I needed to provide a privacy policy? As it turns out, Aiden was the perfect candidate for this job. Within just several minutes, Aiden generated an HTML page containing all the necessary content for our privacy policy. And with that, we were finally able to hit the "Submit" button!

No alt text provided for this image

With Aiden's help, we've finally made it through the app development journey and successfully published our Sudoku app on the App Store. Throughout this process, Aiden provided invaluable assistance in various aspects, such as troubleshooting the distribution error, suggesting name options for the app, and drafting the privacy policy.

Looking back at our collaboration, the entire project cost just $40, comprising a $20 monthly subscription for AI assistance and $20 for graphic design. Moreover, it only took 12 hours of my time to bring the app to fruition. This experience truly showcased the power and efficiency of utilizing AI in software development.

By harnessing AI, developers like myself can focus on tackling core problems while delegating routine tasks (dirty work) to our AI counterparts. This collaboration can help streamline the app development process and create a brighter future for both developers and AI.

As we conclude this project, I want to express my sincere appreciation for Aiden's help. Our teamwork not only brought our Sudoku app vision to life but also made the entire journey enjoyable and efficient. I'm excited about the future and looking forward to working with Aiden on more tasks ahead of us.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了