Hacker News new | past | comments | ask | show | jobs | submit login

> Is it that expensive to separate your business logic from UI and write the small UI layer

Not sure what apps you've built, but usually that business logic is the minority of the codebase. The rest of the stuff is boilerplate, like drawing boxes, describing layouts, handling events, managing state. All this has nothing to do with business logic.

Ideally, I want to write it once that I want a row of buttons what colors they have and what function should be called when the user clicks on it.

I did what you describe and extracted all the logic in a small component I manage and the result was very banal, extremely straight forward code with was essentially "business logic". The 90% rest was building the UI based on it.




Last major one I worked on that needed to be cross platform was a GPS navigator, which had massive functionality in C and C++ under the hood, called from the platform-specific UI/event handling code through Objective-C-to-C++ on iOS, through JNI on Android, and directly on PC native platforms. It worked pretty well. The ratio of platform-specific to platform-independent code was very small, so it was not like writing the app N separate times. Major engineering savings AND each platform's build had its own UI idioms that users of those platforms were accustomed to. Guess I never realized this was a controversial approach to take!


> Guess I never realized this was a controversial approach to take!

It’s not about controversy. It’s just that in most apps, the UI is far more than 10% of the code base.


>Guess I never realized this was a controversial approach to take!

No, just non-represenative of most apps, who are closer to CRUD than "GPS Navigator".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: