4 ms·
That's a bizarre statement, because chaining leads to shorter lines because each call can gets its own line and there are fewer assignments.
by lupire 4y ago
That's a bizarre statement, because chaining leads to shorter lines because each call can gets its own line and there are fewer assignments.
- theamk 4y agoIn many (most?) languages chaining leads to longer lines unless programmer makes an extra effor to break them. Compare: user = manager.getUser() mobile = user.getPhone(PhoneType.mobile) area = mobile.getAreaCode() vs area = manager.getUser().getPhone(PhoneType.mobile).getAreaCode()
- hrbf 4y agoGood example and exactly what I meant. Having each call on its own line doesn’t solve anything if you also nest the calls.
- Sohcahtoa82 4y agowhat about... area = manager .getUser() .getPhone(PhoneType.mobile) .getAreaCode(); I see this form a lot in Java and Kotlin code, especially in Kotlin where a single function is just assigned to a chain of functions like the one above.