hello, experts

Suppose I have a local machine with a program contains a function with main function, in java it is public static void main, in scala ,it's def object extends App. But now, I want make it to a distributed program, how can I do and make it possible? Maybe it is a direct and simple question I ask. But I want to know it's idea. I think may be it's the right way to implement it with some components called Master and  Work and Client just like in Spark Project. And these components's talk to each other with the akka mechanism. Am I right ? Experts ? 

thanks,
Minglei.