Ask HN: Is my code any good?
11–20 of 44 posts
Re: Ask HN: Is my code any good?
#12Re: Ask HN: Is my code any good?
#13Re: Ask HN: Is my code any good?
#14Re: Ask HN: Is my code any good?
#15Earlier quoted context omitted.
I wanted to get some feedback on my code design and structure. I think that is difficult to get via automated code review.
That's not what your question asks for. Anyway, in my experience, the ability to test with ease is one dimenision of design quality.
Re: Ask HN: Is my code any good?
#16After several years in a test-driven development team, seeing your test directory made me cringe :/
Re: Ask HN: Is my code any good?
#17Was Design+Code your sole source for learning how to program?
Re: Ask HN: Is my code any good?
#18How long have you been coding total? Was Design+Code your sole source for learning how to program?
Re: Ask HN: Is my code any good?
#19After several years in a test-driven development team, seeing your test directory made me cringe :/
Yeah I know I need follow the best practices. I have started writing tests for the next update. But do you recommend TDD for iOS development?
Re: Ask HN: Is my code any good?
#20I'd say overall it looks pretty well written app code, especially if you say you're a beginner. One thing I'd like to point out is that in my (limited Swift) experience, stuff like this:
https://github.com/NikantVohra/HackerNewsClient-iOS/blob/mas...
...where you're force casting/unboxing/whateveritscalled a bunch of things is a smell. Sometimes it's unavoidable because of the weirdness between Cocoa and Swift, so typically your interface builder outlets will be riddled with that stuff, but for your own internal APIs, try and keep things as option-less as possible.
UI code is pretty challenging to keep organized, especially when platforms encourage using things like two-way bindings and keeping state all over the place. I'd recommend checking out Gary Bernhardt's talk "Boundaries" and Andy Matuschak's similar writings (sorry, can't think of anything off the top of my head), as they have some good ideas for demarcating the line between functional parts of your code that should be super clean and the anything goes world of external UI APIs.
Good luck and keep coding!