Product Launch
anonymous
2 points
6 comments
Posted4 months agoActive4 months ago
Show HN: Shout is an Android app to post opinions using the Google Nearby API
github.comAndroidGoogle Nearby APIKotlin
Discussion (6 comments)
Showing 6 comments
All the logic and UI code of your application is in a single file, MainActivity.kt (not counting the app theme, those files are separate), which has 1073 lines of code. No services, repositories, models, utility files, and no design patterns to make your life easier. Conclusion: maintaining the project will be very, very difficult. I’m impressed by your iron nerves.
I don't really see the problem. A hundred of those lines is just imports and the rest is already split into logical groups with comment sections. Most of this is not mentally taxing code either, you can just read it straight. Sure, it would be nice to split it up, but it really isn't as much of a problem here as you make it out to be.
If you plan to maintain the application in the future, using MVC/MVP/MVVM patterns will reduce the cognitive load, allowing you to implement new features and fix bugs much faster. I also noticed that you started writing this small application from May 10 to September 13 (with 'First Production' commits on September 7), which is almost 4 months. However, such an application can usually be written within 1 month at most (with design patterns), even if the developer is a beginner. The further the application develops, the harder it will be to maintain, because too much refactoring will be required (large chunks of code will need to be deleted or replaced, which increases the risk of new bugs). In addition, inheritance is necessary so that, through polymorphism, implementations can be replaced without introducing new bugs and while extending functionality. In short, there needs to be a balance between inheritance and refactoring so that the application can be maintained for decades.
This is silly, I'm not even the author of the linked app, so I'm not sure what you're on about. Splitting up a few hundred lines of code would be nice, sure, but it's not even remotely as big of a problem as you try to make it out to be.
4 months ago
Thanks for noticing the comments. I usually start writing pseudo-code which then naturally morphs into line comments. I'm using Android Studio and found the expand/collpase feature a very useful way to zoom in and out of the code when needed. The problem is that it doesn't force to think modularly since the collapsed sections/functions already kinda look like separate modules.
4 months ago
Thanks for the feedback. This project was an excuse to learn Android/Kotlin and now that the app is working I'll look into splitting MainActivity.kt
I want to start with the UI since the Composables functions are primed for modularity.