« first day    last day (17 days later) » 

12:01 AM
As for my example about two different types of numbers was that not only you may need to check if collection is not empty, but have a logic select one item from several in the collection and even have to block SMS even for non-empty collections. You will have to duplicate that logic in the aforementioned lines in CustomerFrag and OrdersFrag and I can put it only once
As for
Now if we are talking about that. Tell me what you would do if number of data types handled by your app would grow to say 30 and each single type would introduce some custom property to handle? I'm curious how you would see isVisbleImpl() function in that scenario.
What's wrong with my "Copy Order" example? It does access specific field of specific Fragment
As for "(besides that fact, that it actually works)", Einstein famously said that "Everything should be made as simple as possible, but not simpler." It seems to me you are trying to protect your design as if it works i.e. providing some merits of taking fewer lines of code etc. But I think that unless you make your design work, you can't argue that (because I don't see how you can make it work in practice without rolling out as much code as I did or even more)
 
 
13 hours later…
12:46 PM
"In your original arhice CustomerFrag.java lines 38-41 and OrdersFrag.java lines 41-45 aren't those 3 quite similar to 3 of 4 another lines? Can you find such duplication in my code?"

Yes those 7 lines are similar. But:

- They are not the same.
- They are obligatory and only add extra future. (app would be fine without them)
- I already explained it in previous message...

And yes, I can find duplication in your code. Starting from line 184 in BaseCustomFragment.java,
across next ~90 lines you have 10 distinct lines, 5 similar lines and and 5 lines that are perfectly cloned 5 times (5*5 =
 
 
11 hours later…
11:22 PM
I think I see two major points of disagreement so I'll try to cover them from my point of view

1. "(besides that fact, that it actually works)"

I'll start with an analogy. Let's assume someone discusses serveral projects to inhabit Mars. There is one project that will cost hundreds of billions dollars and we can't even start it in next decade because it requires first putting building some infrastructure on Mars and only then moving there first long-term inhanbitants. And there is another project that it much cheaper and we can start it just any day we like. The only issue is that it assu
2. Duplication

We have significantly different measurement of duplication. You seem to count raw lines of code whereas I count lines of code with (business) logic.

To me the similar additional lines in my code is only a minor problem because there is almost no logic in them. This is actually why IDE can generate them for me. As for lines with logic, I have much less duplication than you do. And my test is that I suggest changing business logic and asking how many lines you would need to change and you seem to ignore that.
[quote]
Wait! I just realized that you've removed this extra functionality that you can call customer associated with order, directly from orders fragment - And this is exactly what those 7 "duplicated" "Call, SMS..." lines are for...

In OrdersFragment "onItemLongClick()" I have

"setContext(o.getCustomer())" which is setting "conCon" variable

and than this customer instance is used in BaseCustomFragment:

"}else if(item.getTitle() == "Call"){
u = Uri.parse("tel:" + Uri.encode(conCon.getPhoneNumbers().get(0).toString()));"
Now to your change in logic requirement of adding Employee.

You would have to write something like:

"protected boolean isVisibleImpl(Customer conCon, Localization locCon, Employee emp){...}"

I just happen to prefer explicit passing of required data to method but if you look at how isVisibleImpl is called you'll notice, that the class has access to `conCon` and `locCon` from the BaseCustomFragment. So first approach would be actully remove those arguments altogether.

Still as I prefer more explicit code, I would create some `SelectionContext` class and put all the relevant fields there a
 

« first day    last day (17 days later) »