Best way to implement a "server" class in Java (Android)
I'm doing an application for Android. One of my classes is Sound which offers methods like playAlarm()
and playSong(String name)
. Whats the best way to implement that kind of class,开发者_开发百科 as an object accessed with a singleton or as a static class with those static methods? From the point of view of app perfomance in Android.
There is probably little difference in performance but using a singleton instead of static methods will make it easier to unit test.
Barry
精彩评论