Discussion:
[dart-misc] Dart's dim view of static methods
Abdullah Hashim
2018-10-05 08:52:25 UTC
Permalink
Hello all,

I'm very new to Dart. I read in Christ Storm's, "Dart for Hipsters" that
Dart takes a dim view of static methods. I wonder if this is accurate and
if so why?

Thanks.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/366f48a0-50e9-4bee-b740-0017d5707da5%40dartlang.org.
'Bob Nystrom' via Dart Misc
2018-10-05 21:35:34 UTC
Permalink
I haven't opened that book in a long time, but I *believe* he's saying
that, unlike Java and C#, you don't *have* to use static methods for
operations that don't naturally belong as instance methods in some class.
Instead, Dart is happy to let you define bare top level functions, like you
can in C or JavaScript.

If that's what Chris is getting at, yes, I think it's accurate. You can use
static methods, of course, and we use them pretty frequently. But unlike
C#/Java, you shouldn't need to define pointless "Utils" or "Helpers"
classes just as bags to stuff unrelated functions in. You can just make
functions.

Cheers!

– bob
Post by Abdullah Hashim
Hello all,
I'm very new to Dart. I read in Christ Storm's, "Dart for Hipsters" that
Dart takes a dim view of static methods. I wonder if this is accurate and
if so why?
Thanks.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit https://groups.google.com/a/
dartlang.org/d/msgid/misc/366f48a0-50e9-4bee-b740-
0017d5707da5%40dartlang.org
<https://groups.google.com/a/dartlang.org/d/msgid/misc/366f48a0-50e9-4bee-b740-0017d5707da5%40dartlang.org?utm_medium=email&utm_source=footer>
.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CAF8T8LzajVZvCD8vq8A6UbQkK3uNaMJKaN16iUAD485njUmJSg%40mail.gmail.com.
Continue reading on narkive:
Loading...