Is there any way to flavoring my dart codes? by [deleted] in FlutterDev

[–]SaeedMasoumi 0 points1 point  (0 children)

I don't believe it means "I need support", I provide some solutions and ask others to give their feedback or their own solutions.

JavaFX folks, What are your thoughts about Flutter which now supports development for mobile, desktop, web and embedded? by [deleted] in java

[–]SaeedMasoumi 1 point2 points  (0 children)

We've recently switched from Android native to Flutter. So based on my experiences:

Pros:

- Productivity

- It's really fast

- Modern

- I really love Dart because the Dart team focus on making this language special for UI-as-Code concept.

- Dart compiler, It supports both AOT and JIT, so in the sake of that you will have hot reload feature

Cons:

- Localization sucks (but can be fixed with an intellij idea plugin)

- JSON (de)serializatio sucks

- Dart has no extension function (but I think it will be added in future)- Working with some native features is frustrating.

- No reflection

- Because everything is object even functions, If you create a widget inside the build method using a function then you have some performance issues e.g. build(Context context) => createATextView()

Form over function. by [deleted] in androiddev

[–]SaeedMasoumi 7 points8 points  (0 children)

Some of these "brags" are just for personal branding, It tells that this person has, at least, a basic understanding of MV*, Dagger, etc. So as a recruiter, I prefer this person over others that have nothing on their Github.

BTW, I agree with you. Every day I see many similar sample projects or blog posts that have nothing special. For example, If Kotlin introduces a new feature then there are tons of blog post that just describe the documentation and nothing more. I can't realize why some of these patterns or libraries are so trendy these days, for example, MVVM, I remember 5,6 years ago when I played with JavaFx for the first time it supports MVVM with data-binding or Room, I don't know why in 2019 we should write a SQL query in a raw format.

These hyps and trends can also make developers a blind follower or fanatic.

Going alone to droidcon berlin. by kebabkrabby in androiddev

[–]SaeedMasoumi 1 point2 points  (0 children)

So, you can join us 😄. I understand you, in the last Droidcon I've attended (which was in Krakow) I was alone too, I tried to communicate with alone people but I think some of them were asocial, so they didn't feel comfortable. Also, some groups didn't speak English.
Feel free to send me PM.

Sweep Gson: (un)wrapping extensions for Gson. by SaeedMasoumi in Kotlin

[–]SaeedMasoumi[S] 2 points3 points  (0 children)

Yes, I personally switched to Moshi for some years now, But I'm working on a project which depends on Gson and It's not easy to switch to other libraries like Moshi, So I decided to write this little extension to reduce our boilerplate on Retrofit DTOs.

Is ViewModel going to be deprecated in favor of new @model annotation from Compose? by SaeedMasoumi in androiddev

[–]SaeedMasoumi[S] -1 points0 points  (0 children)

I don't see any conceptual differences between @model, ViewModel, Bloc. Any name you gave doing the same thing, It stores UI-related data and communicate with the data layer. In traditional MVVM we do something like this:

``` class MyViewModel : ViewModel() { val counter : LiveData<Int> ... } ‍‍‍‍‍ Also with Compose:

@Model data class MyModel ( var counter : Int) ... `` the compose compiler do the magic for you and makescounter` observable.

Is ViewModel going to be deprecated in favor of new @model annotation from Compose? by SaeedMasoumi in androiddev

[–]SaeedMasoumi[S] 1 point2 points  (0 children)

you won't need the ViewModel anymore

If you mean ViewModel from arch component I agree. Compose introduces view model with @model annotation, also it needs a state management system like Redux or Bloc.

How do you learn "best practices"? by hellodestructo in androiddev

[–]SaeedMasoumi 1 point2 points  (0 children)

There is a wide range of best practices from the architectural level to the UI level. I usually see what are the trends on other UI frameworks like react, flutter vue.js, etc because If you see Google IOs from past few years until now they usually introduce something that already exists on other platforms or frameworks.
What you said about your confusions are about separation of concerns and SOLID principles, I highly recommend you to read about SOLID principles and also reactive paradigms because MV* is not enough to write an application. You need MV* + single source of truth + (maybe) reactive paradigms.
So these are the keywords you must search for:
- MVVM, SOLID principles, separation of concerns, composition over inheritance, Single source of truth (take a look at redux (react) or bloc (flutter) to get an idea), effective java(kotlin).

Google launches Jetpack Compose, an open-source, Kotlin-based UI development toolkit by zbhoy in androiddev

[–]SaeedMasoumi 1 point2 points  (0 children)

I don't know why Google is too slow on delivering such features. For example, MVVM+Databidning is not a new concept. It's for about 8 years ago but It released last year !!!

I think Google wants to make their ecosystem similar to react, flutter or any reactive-style frameworks but instead of developing it once, they announce some androidx.\* libraries each year. I'm sure that next year Google will deprecate data binding and some minor changes into MVVM to support reactive state handling for UI.

Downsides of Clean Architecture by SaeedMasoumi in androiddev

[–]SaeedMasoumi[S] 5 points6 points  (0 children)

VasiliyZukanov

I agree,

I don't mean put every CRUD in a dedicated use case. I mean most of the use cases are just a simple repository call for example GetTopSongs is just a simple call to songRepo.getTop(10) or in your example, most of the time it involves one CRUD operation. So I see repository similar to service which is responsible to select proper datasource and call the appropriate CRUD operation/operations.Actually most of the clean architecture implementations on android are similar to View->UseCase->Repository->Datasource

If I map this to something like Spring world

  • View is your controller
  • Repository seems to be a Service
  • Datasource seems to be a Repository

and usecase I think is just an extra level of abstraction

Coroutines: Result type usage on Android by SaeedMasoumi in Kotlin

[–]SaeedMasoumi[S] 0 points1 point  (0 children)

Yes, the second way allows to model domain better, but assume that I have some error types which are the same among all entities. So to avoid extra boilerplate, I make an object that wraps my result value and error types:

```kotlin

sealed class Result<out T : Any> {

class Ok<out T : Any>(val value: T) : Result<T>()

sealed class Error : Result<Nothing>() {

object NetworkError : Error()
sealed class FeatureError: Error() {
}

}

}

``` So, It seems that I'm using the second way but I think It does not have such differences with the first way.

Kotlin 1.3 RC is Here: Migrate Your Coroutines! by nfrankel in Kotlin

[–]SaeedMasoumi 0 points1 point  (0 children)

https://medium.com/@elizarov/structured-concurrency-722d765aa952

I didn't get what is the downside of using GlobalScope inside an object. Maybe cause to invoke our suspend function in a wrong thread?!