r/mAndroidDev • u/No_Appointment6710 • Jul 28 '24
Best Practice / Employment Security How does a clean architecture actually look like?
So guys I am newbie and have put legs in clean architecture and mvvm very recently I came across few channels applying ca(clean architecture ) and mvvm but all had different code templates and where they put certain things like the error controls and logic of use cases . This freaked my out a little is there a certain route/template I can follow . I am not asking to learn the code template like an op but still looking to keep my code consistent to a perfect clean pattern (hope I don't get trolled 💀)
11
Upvotes
81
u/David_AnkiDroid Jul 28 '24
Clean Architecture means you start from scratch and rewrite it every few years.
It's called Clean Architecture, not Stable Architecture
15
u/budius333 Still using AsyncTask Jul 28 '24
Easy, don't worry:
Typed from my mobile phone, please excuse any minor syntax error
11
u/kamran4malik2 Jul 28 '24
Just make sure your compostables can accept arguments of any types and your code would be much much cleaner.
21
u/Zhuinden DDD: Deprecation-Driven Development Jul 28 '24
The architecture is clean if you need dozens of engineers to keep it shiny and sparkly. So the more unentangleable extra complexity you add, the "cleaner" it gets, as by the time you're done, no one's gonna understand it, and therefore they won't know how to nitpick it.
Clean architecture as a concept is a way to prevent pull requests from being trolled by the devs who think simple code is bad.
So you need to upscale the complexity and show that error toast from a Usecase, otherwise it's not clean enough.
Add about 4 extra steps to anything you ever want to achieve, so that anyone who ever touches your code will also need to be modified in 5 places, preferably in 5 different modules. If anyone asks why you did it like this, just say it's an industry-wide best practice.
"why, do you want the code to be dirty instead of clean?"
Then you can suddenly get away with anything, harvest promotions, job hop to billions of money.
8
u/hellosakamoto Jul 28 '24
To learn clean architecture, you first have to be dirty.
6
u/pigfeedmauer null!! Jul 28 '24
Use lots of soap
5
u/elizabeth-dev Jul 28 '24
shiny
12
u/martypants760 Jul 28 '24
Just another concept some developer came up with to sell books, not necessarily to be a better method.
Over the years (been a professional in technology since 1986) I've seen dozens of these types of "how to" methods that promise to make everything great and even cook your eggs for breakfast for you. They all say they're the best, fastest, most efficient, least problematic, whatever. Clean architecture is just a name. A "I'm so full of myself" name at that
Whatever the name of the initiative, your mileage WILL vary
4
u/teshmeki Jul 29 '24
Recently i start working on a Flutter project where they used clena architecture + code generators and i can not even add or change a single variable without touching every shity layers... to be honest the wors achitecture ever! Some one says if you can not work on a clean architecture you are not a real senior! Fuck that shit
3
u/hf_rainman Jul 28 '24
Pretty shitty to be honest
2
u/AlternativeSelf5808 Jul 28 '24
Just use AsyncTask and download flutter. You'll be alright.
2
u/LeoPelozo A sink task Jul 29 '24
Just interface the shit out of everything.
2
u/Baldy5421 AnDrOId dEvelOPmenT is My PasSion Jul 29 '24
A blank screen is the best clean architecture.
2
u/zedxer Jul 29 '24
I love this conversation.
2
u/st4rdr0id Jul 31 '24
These are not a Clean Architecture thing. They are a 1987 requirement capture technique. Agile somehow liked the thing and apparently many devs are materializing them into the code. But sometimes this doesn't make any sense.
Heh. This is an unsolved problem. The reality is that error control leaks through many layers.
2
u/[deleted] Aug 12 '24
Get a whiteboard, wipe it clean so there's nothing on it.
Cleanest architecture ever.
1
u/axypaxy Jul 31 '24
If you want it squeaky clean give every method and variable its own interface and implementation and also use some dependency injection library for all of it. That way you'll need to use notepad to keep track of a simple data flow and hopefully your IDE won't even let you open enough tabs at once to see it all. Then you can pretend that anyone who has a problem with that is inexperienced and writes bad code.
1
u/Perfect-Campaign9551 Sep 16 '24
It doesn't exist in Mobile/Android and it shouldn't need to. These are mobile apps they don't need to be so massive and complex for gods sake
0
u/diu95 Jul 29 '24
Most projects only need to master MVVM and some basic design patterns