from legacy to hexagonal (an unexpected android journey)
DESCRIPTION
Esta charla comprende las lecciones aprendidas convirtiendo la app de Android de Teambox (una app repleta de deuda técnica y con un alto nivel de acoplamiento entre clases), en la versión actual de Redbooth, que intenta cumplir la arquitectura Hexagonal y los principios SOLID. Durante la exposición explicaremos como fuimos desenredando el código paso a paso; como aplicamos por partes los conceptos de la arquitectura hexagonal; como dejamos de lado componentes del framework de Android que dificultaban el mantenimiento de la app; y que errores cometimos, como los solucionamos y como se podrían haber evitado.TRANSCRIPT
![Page 1: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/1.jpg)
From Legacy to Hexagonal (An Unexpected Android Journey)
Rubén Serrano @Akelael Lead Android Developer @RedboothHQ
José Manuel Pereira @JMPergar Android Software Engineer @RedboothHQ
![Page 2: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/2.jpg)
Agenda
1. From Legacy Code
2. Towards Hexagonal Architecture
3. To infinity, and beyond!
![Page 3: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/3.jpg)
1. From Legacy Code
![Page 4: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/4.jpg)
Meet the team
![Page 5: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/5.jpg)
![Page 6: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/6.jpg)
![Page 7: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/7.jpg)
One dev from a contractor
![Page 8: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/8.jpg)
One dev from a contractor + one senior iOS dev
![Page 9: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/9.jpg)
One dev from a contractor + one senior iOS dev
![Page 10: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/10.jpg)
One dev from a contractor + one senior iOS dev + one junior iOS dev
![Page 11: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/11.jpg)
One dev from a contractor + one senior iOS dev + one junior iOS dev
![Page 12: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/12.jpg)
A different Android dev One dev from a contractor + one senior iOS dev + one junior iOS dev
![Page 13: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/13.jpg)
A different Android dev One dev from a contractor + one senior iOS dev + one junior iOS dev + one confused Android team
![Page 14: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/14.jpg)
Meet the code
![Page 15: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/15.jpg)
![Page 16: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/16.jpg)
Meet the problem
![Page 17: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/17.jpg)
1. We have a huge technical debt
![Page 18: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/18.jpg)
1. We have a huge technical debt
![Page 19: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/19.jpg)
HUGE
![Page 20: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/20.jpg)
![Page 21: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/21.jpg)
1. We have huge technical debt
2. We can’t stop developing new features
![Page 22: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/22.jpg)
1. We have huge technical debt
2. We can’t stop developing new features
3. We can’t remove debt at this point and we shouldn’t add any more
![Page 23: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/23.jpg)
2. Towards Hexagonal
![Page 24: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/24.jpg)
Working with legacy code
![Page 25: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/25.jpg)
Read this book
![Page 26: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/26.jpg)
What have we learnt from pizza?
![Page 27: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/27.jpg)
You just don’t eat the whole pizza at once
![Page 28: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/28.jpg)
1. Slice the big methods into small meaningful methods
![Page 29: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/29.jpg)
1. Slice the big methods into small meaningful methods
2. Identify different responsibilities and move them to other classes
![Page 30: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/30.jpg)
1. Slice the big methods into small meaningful methods
2. Identify different responsibilities and move them to other classes
3. Use less coupled framework components (or no components at all)
![Page 31: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/31.jpg)
Model View Presenter
![Page 32: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/32.jpg)
In theory
![Page 33: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/33.jpg)
View
Presenter
Model
![Page 34: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/34.jpg)
Notifies events
View
Presenter
Model
![Page 35: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/35.jpg)
Requests data
View
Presenter
Model
![Page 36: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/36.jpg)
Serves data
View
Presenter
Model
![Page 37: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/37.jpg)
Change data representation
View
Presenter
Model
![Page 38: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/38.jpg)
Tells how to draw
View
Presenter
Model
![Page 39: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/39.jpg)
Layout +
Activity/Fragment
Presenter
Data +
Business logic
![Page 41: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/41.jpg)
listAdapter = new SimpleCursorAdapter(getActivity(), android.R.layout.simple_list_item_1, null, new String[]{FakeDatabase.COLUMN_NAME}, new int[]{android.R.id.text1}, 0);listView.setAdapter(listAdapter);
MainFragment
![Page 42: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/42.jpg)
getLoaderManager().initLoader(0, null, new LoaderManager.LoaderCallbacks<Cursor>() { @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new CursorLoader(getActivity(), MainContentProvider.URI, null, null, null, null); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { listAdapter.swapCursor(data); } @Override public void onLoaderReset(Loader<Cursor> loader) { listAdapter.swapCursor(null); }});
MainFragment
![Page 44: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/44.jpg)
MainView & MainModel
public interface MainView { public void swaplListData(Cursor cursor);}
public interface MainModel { public void setPresenter(MainPresenter presenter); public void startLoadingData(Context context);}
![Page 45: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/45.jpg)
MainFragmentpublic class MainFragment extends Fragment implements MainView { //... @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); presenter = PresenterFactory.getMainPresenter(this); }
@Override public void onActivityCreated(Bundle savedInstanceState) { //... presenter.notifyOnCreate(getActivity()); }
@Override public void swaplListData(Cursor cursor) { listAdapter.swapCursor(cursor); }
![Page 46: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/46.jpg)
MainPresenterpublic class MainPresenter { private MainView mainView; private MainModel mainModel; //... public void notifyOnCreate(Context context) { mainModel.startLoadingData(context); } public void notifiyLoadedDataAvailable(Cursor cursor) { mainView.swaplListData(cursor); }}
![Page 47: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/47.jpg)
PresenterFactory
public class PresenterFactory { public static MainPresenter getMainPresenter(MainView view) { MainModel model = new MainCursorModel(); return MainPresenter.newInstance(view, model); }}
![Page 48: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/48.jpg)
MainCursorModelpublic class MainCursorModel implements MainModel { //... @Override public void startLoadingData(Context context) { new LoadDataAsyncTask().execute(context); } private class LoadDataAsyncTask extends AsyncTask<Context, Void, Cursor > { //... @Override protected void onPostExecute(Cursor result) { super.onPostExecute(result); presenter.notifiyLoadedDataAvailable(result); } }}
![Page 49: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/49.jpg)
Pros & Cons
View decoupled from model
Cleaner code and smaller fragment/activities
View and model not really decoupled (cursor)
All the components use the framework
![Page 50: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/50.jpg)
Hexagonal Architecture
![Page 51: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/51.jpg)
In theory
![Page 52: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/52.jpg)
Layout +
Activity/Fragment
Presenter
Data +
Business logic
![Page 53: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/53.jpg)
Layout +
Activity/Fragment
Data domain
Business logic
![Page 54: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/54.jpg)
Layout +
Activity/Fragment
Database
Business logic
Network
Sensors
![Page 55: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/55.jpg)
Sensors
Network
Database
Layout +
Activity/Fragment
Business logic
![Page 56: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/56.jpg)
Business logic
Sensors
Network
Database
Layout +
Activity/Fragment
![Page 57: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/57.jpg)
Business logic
Port Port
Port
Port
Sensors
Network
Database
Layout +
Activity/Fragment
![Page 58: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/58.jpg)
Sensors
Network
Database
Layout +
Activity/Fragment
Adapter Adapter
Adapter
Adap
ter
Business logic
Port Port
Port
Port
![Page 59: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/59.jpg)
Sensors
Network
Database
Layout +
Activity/Fragment
Adapter Adapter
Adapter
Adap
ter
Business logic
Port Port
Port
Port
![Page 60: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/60.jpg)
Sensors
Network
Database
Layout +
Activity/Fragment
Boundary Boundary
Boundary
Boun
dary
Business logic
Port Port
Port
Port
![Page 61: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/61.jpg)
Module Core
Module App
Module App
Module App
Module App
Core Core
Core
Core
App App
App
App
![Page 63: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/63.jpg)
MainFragmentpublic class MainFragment extends Fragment { //... private MainFragmentBoundary viewBoundary; @Override public void onCreate(Bundle savedInstanceState) { //... viewBoundary = MainFragmentBoundary.newInstance(this); } @Override public void onActivityCreated(Bundle savedInstanceState) { //... viewBoundary.notifyOnCreate(); }
![Page 64: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/64.jpg)
MainFragment
public void setListAdapter() { listAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, android.R.id.text1, new ArrayList<String>(0)); listView.setAdapter(listAdapter);} public void swapList(List<String> names) { listAdapter.clear(); listAdapter.addAll(names);}
![Page 65: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/65.jpg)
MainFragmentBoundary
public class MainFragmentBoundary implements MainViewPort { private MainFragment mainFragment; private MainLogic logic; //...
public void notifyOnCreate() { logic.notifyOnCreate(); } @Override public void swaplListData(List<String> names) { mainFragment.swapList(names); }
![Page 66: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/66.jpg)
MainModelBoundarypublic class MainModelBoundary implements MainModelPort { private MainLogic logic; private MainRepository repository;
//... @Override public void startLoadingData() { repository.startLoadingData(new MainRepository.OnDataLoadedListener() { @Override public void onDataLodaded(Cursor cursor) { notifyDataLoaded(cursor); } }); } private void notifyDataLoaded(Cursor cursor) { List<String> names = mapCursorToList(cursor); logic.notifiyLoadedDataAvailable(names); }
![Page 67: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/67.jpg)
MainModelBoundary
private List<String> mapCursorToList(Cursor cursor) { List<String> names = new ArrayList<String>(); int nameColumnIndex = cursor.getColumnIndex(FakeDatabase.COLUMN_NAME); while (cursor.moveToNext()) { String name = cursor.getString(nameColumnIndex); names.add(name); } return names;}
![Page 68: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/68.jpg)
Pros & ConsLogic is not going to be affected by framework changes
Logic is pure Java: easier to test
Less changes when replacing a plugin
Easier for 2 devs to work on the same feature
More complex architecture
Need to map each POJO for each layer
What happens when the plugins need to cooperate?
![Page 69: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/69.jpg)
3. To infinity, and beyond!
![Page 70: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/70.jpg)
One plugin, N commands
![Page 71: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/71.jpg)
Sensors
Network
Database
Layout +
Activity/Fragment
Boundary Boundary
Boundary
Boun
dary
Business logic
Port Port
Port
Port
![Page 72: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/72.jpg)
Model Plugin
Layout +
Activity/Fragment
Boundary BoundaryBusiness logic
Port Port
![Page 73: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/73.jpg)
Create task
Send chat message
Update note
Request projects
Business logic
Port Model Plugin
Boundary
![Page 74: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/74.jpg)
Asynchrony?
![Page 75: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/75.jpg)
Create task
Send chat message
Update note
Request projects
Business logic
Port Model Plugin
Boundary
![Page 76: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/76.jpg)
We don’t like:
callback’s hell + AsyncTasks
![Page 77: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/77.jpg)
We don’t like:
callback’s hell + AsyncTasks
We don’t mind (but could be a problem):
only commands in separate threads
![Page 78: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/78.jpg)
We don’t like:
callback’s hell + AsyncTasks
We don’t mind (but could be a problem):
only commands in separate threads
We would love:
RxJava
![Page 79: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/79.jpg)
Use cases
![Page 80: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/80.jpg)
Model Plugin
Layout +
Activity/Fragment
Boundary BoundaryBusiness logic
Port Port
![Page 81: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/81.jpg)
Model Plugin
Layout +
Activity/Fragment
PresenterUse
Case
Model Plugin
Use Case
Repo
sito
ryModel Plugin
Use Case
![Page 83: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/83.jpg)
When?• If you expect 2+ devs working on the same
feature
• Unless you are sure the app is going to die in a near future
• You know for sure you will change your plugins
![Page 84: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/84.jpg)
How?
1. Simple refactors
2. Model View Presenter
3. Hexagonal
![Page 85: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/85.jpg)
How?
1. Simple refactors
2. Model View Presenter
3. Hexagonal
4. Clean Architecture
![Page 86: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/86.jpg)
Thank you!
![Page 87: From Legacy to Hexagonal (An Unexpected Android Journey)](https://reader033.vdocuments.us/reader033/viewer/2022060121/559444781a28abfa2f8b474b/html5/thumbnails/87.jpg)
Questions?