r/programming • • Dec 03 '18

Open Source .NET – 4 years later

http://mattwarren.org/2018/12/04/Open-Source-.Net-4-years-later
53 Upvotes

16 comments sorted by

View all comments

Show parent comments

1

u/m50d Dec 04 '18

Being able to reuse all your functions and datatypes in different components of the same system is really useful. For a "big" dedicated UI, the advantages of a language that's better at UI might outweigh the costs of reimplementing everything, but certainly for a little utility that's part of a larger system you're much better off using the same language.

0

u/[deleted] Dec 04 '18

Why would you ever want to reuse something from your logic part in your GUI? Reeks of a very leaky abstraction.

GUI must be entirely separate and, ideally, unless it's 3D models, video or audio, must communicate with your logic over a dumb text-based protocol.

1

u/m50d Dec 04 '18

Most immediately you want to run the same validation code on the GUI and the backend - a lot of bugs are caused by inconsistent validation in different places.

But you also want to use the same datatypes - why have two representations for the same thing? Of course it's important that what you pass between client and server be inert data (i.e. records), but there are far better ways to achieve that than a custom text-based protocol, which is adding a lot of overhead and opportunities for error to no benefit.

0

u/[deleted] Dec 04 '18

Validation in the ui and the logic layer are different. Do not be a lazy copy-paster, do the right thing.

And, text-based communication have tons of benefits:

  • scriptable

  • easy to replace gui frontends

  • testable

  • easy to insert something (e.g., logging, network forwarding, etc.) in between

And no drawbacks whatsoever, IPC is much faster than your gui latencies anyway (unless it's a video, of course)

2

u/m50d Dec 04 '18

Validation in the ui and the logic layer are different.

No, the same type has the same set of valid states, by definition.

Do not be a lazy copy-paster, do the right thing.

This is utterly backwards. You avoid copy-pasting by avoiding repeating yourself, which means reusing the same logic - not a copy but the actual same code - when you want to do the same thing.

And, text-based communication have tons of benefits: scriptable easy to replace gui frontends testable easy to insert something (e.g., logging, network forwarding, etc.) in between

All that remains true for more structured communication mechanisms, which avoid the security issues and unreliability inherent in text-based approaches. Custom parsers are still one of the biggest sources of security vulnerabilities, and interleaving control and data is still another one.

→ More replies (0)