title: Function returning a session object - is this alright?
body: <p>Lets say I would like to build an application to connect to a server and upload, delete, ... files.</p>
  
  <p>At first I need to connect somehow and I need a session. Can I build a function that is returning a session and after that I can do whatever I want with this session object? Something like:</p>
  
  <pre><code>mySession connect(url, user, password)
  {
    //connecting
    return session;
  }
  
  void uploadFile(File f) {/*...*/};
  
  var currentSession = connect(/*...*/);
  
  currentSession.uploadFile(...);
  currentSession.deletFile(...);
  currentSession.close(...);
  </code></pre>
  
  <p>Could this be good? If I have a session object I can pass it everywhere and say <code>.upload</code>, <code>.delete</code>, <code>.whatever</code>.</p>
  
  <p>And what do you think about the functions like <code>void uploadFile()</code> - maybe I should change void? Because after an upload how do I know that it was successful? Maybe a boolean is better? (if I get true, I know it was successful and if false It wasnt). Any ideas? ;) Thx</p>