|
Hi guys! Soon after finishing "Hacking With Swift" course, I decided to make my own poker chips management app (with which you manage all players' chips with no need of using physical ones). It's been almost 2 weeks now and... I'm lost. Filled with frustration from multiple bugs, millions of "ifs and elses" with (much likely) way too many " So, for the last 3 days I couldn't help but think that I've been running in circles, with no light at the end of the tunnel. Have you ever experienced something like this? How do you deal with such problems? Should I push forward or just jump to another project, taking a (most likely, ever-lasting) break from this one? Cheers! |
|
Hello, I think you made a right decision starting your own project even though it may not feel like it. Even though HWS tutorials will teach you a lot, following a tutorial is still very different to building your own app because suddenly you need to invent everything yourself. I still remember when I was building my first app 3 years ago, it is quite simple but it took me so much time and lot of if was probably way more complicated than was needed. It may be also possible that you choose too complicated app project for a start, hard to say. I think if you were willing you could find people here (myself included) who could do you a code review of current progress but I dont know how to organize it. Since the standard way is to open a pull request in GitHub or GitLab and people can comment on new changes. |
|
Hi Filip, Thanks for your uplifting words :) I created a new repository, I would be extremely grateful if you could take a look: https://github.com/DorianZet/Poker-Chips-App I don't know much about pull requests though, GitHub's explanation is a bit unclear to me. Of course, anyone is more than welcome to look at what I cooked up and comment on that! :D Thanks! |
|
Mateus, You are not alone. The fact that you made it this far is proof that you're good enough. I think everyone on here would agree they've been in this same position as the code took on a life of its own... This is when I step away from the computer and break out the notebook. Sketch some states, write out the conditionals, regroup and refresh around your original requirements. Then rewrangle your code. Good luck! I think you have a great concept, but be sure to add a KR safety feature to keep you from counting while you're sitting at the table. Sorry, couldn't pass up the joke. |
|
hi, what Filip and Daniel said! building your own app mostly consists in having an idea of where you want to go (you have that), deciding on what the data is (you have that), building a UI (that's not easy to get right and it will change as you use your app), and supporting the UI <--> data interaction (the MVC stuff). when you get to the last part, that's when you start to do real coding, and a lot of doing that easily comes from experience. the issues you're running into now (in UIKit) are exactly where you start to lose focus: large ViewControllers (i.e., PokerTableViewController) and code that seems to go on and on (especially code that's repetitious, or put together with plenty of copy-paste for different cases). it's part of the process; don't fear it; embrace it; and you'll learn from it. in any app that i'm happy with, i've thrown out far more code during development than appears in the final version of the app. one general comment about your code: if you start repeating code, over and over, it's a sign you need to clean that up. too many bugs will show up because you copied code from one place to another, edited it, but forgot to edit it somewhere else. in those cases, it's usually some combination of either well-chosen functions of simple loops that will solve the probem. one example: take a look at your TableSettingsViewController. those last 100 lines, broken out by case, are all the same code, except for the number of times you add a TextField and configure it. but you really just need to add a TextField for each player. here's a simple loop that does the same thing:
and one other example: in PokerTableViewController, you write
if your
my recommendation: keep going. but be ready to put the brakes on every now and then and follow Filip's and Daniel's advice. hope that helps, DMG |
|
@MateusZ I will try to have a look at your code today or tomorrow. Also as @DMG already said anytime you have repeated code like these buttons or labels you can use loops, |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's all new Paywall Editor allow you to remotely configure your paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.