Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more: , +
Hey everybody,

Lately, I've been trying to do something which I find very cool to improve my project's productivity (at least I find it cool... ;) ).

Anyway, What I'm trying to do is to regenerate my server side's protocol classes, which is written in C# in my application's client languages, which are Java and Objective-C. (I think you see where I'm going with that...)

My main goals are:
a. Minimization of synchronization overheads. The client developers should not have to re-write server code. Also, an automatic process would hopefully reduce bugs (wrong serialization configuration, etc...).
b. Separation of client object logic and the serialization parameters. I would like to have the auto-generated code to be recreated before any version is compiled without affecting client's logic. (Partial classes, Y U NO EXIST IN JAVA?)
c. My requests form a really neat class tree. Where every node in the tree adds its own essential parameters to the request. I would like it to remain like that.

I'm here to discuss alternative solutions for Java. As partial classes do not exist. It seems like it would be necessary to do some ugly things, such as ProtocolRequest extends ProtocolRequestParameters, or maybe it would contain the parameters struct as a member. The closest method that fits my desires would be an auto-generated section within a class, and embedding changes within it.

My main concern is that it would be impossible to send a request to server properly, while my current design is trying to be very accurate and object-oriented (in other words awesome). I'm afraid that limitations imposed by Java will ruin my efforts.

I would appreciate some good advice and suggestions on how to auto-generate my classes. I would be really grateful if you guys find some good methods / maybe references to existing solutions to fit my needs.

Thank you very much!
Posted
Comments
TRK3 14-Feb-13 18:28pm    
"Awesome" is often extremely counter-productive.

While your approach sounds like it could be a lot of fun to play with, I am skeptical that it would actually increase productivity.

You might be attacking the wrong problem.

If you are constantly changing the interface between your server and client, there is something drastically wrong with your design, or your serialization methods.

The interface between client and server should be extremely well defined and actually fairly simple.

If you think you need to transfer huge, often changing classes between client and server, maybe you have the devision of labor between client and server wrong.

Move all those clever dynamic classes all the way into the client and have your server just serve raw data, or move them all the way into the server, and have your client just display results.

It will make serialization and synchronization of server and client a lot easier, and should cut down on bandwidth.
Sergey Alexandrovich Kryukov 14-Feb-13 18:55pm    
A agree! "Awesome" and "cool" are very indicative, in practice.
If you wish to post it as a Solution, I would gladly up-vote it.
—SA
Sergey Alexandrovich Kryukov 14-Feb-13 18:57pm    
However, I should admit that the question itself is valid, and pretty well formulated.
—SA
TRK3 14-Feb-13 19:01pm    
That's why I didn't post my answer as a solution.

It is a good question, and a fun one to solve.

If the OP was building a framework and had no control of the client/server interface, and the framework was going to be used for hundreds of projects, then it would actually be extremely productive to solve the problem.

If he's got time and wants to work on the problem for fun, then more power to him, he'll learn a lot. Or if he really is solving a problem for lots of other developers, then great.

But if he's getting paid to get a working solution out the door, then he might want to scale back his ambitions, as fun as they might be.

Sergey Alexandrovich Kryukov 14-Feb-13 19:20pm    
Whatever. Again, I agree with your points...
—SA

1 solution

It's possible that you would be interested in the Stab[^] programming language:
class C 
{    
 // Manually implemented property    
 private int myProperty;    
 public int MyProperty 
 {        
  get 
  {            
    return myProperty;
  }        
  set 
  {            
    myProperty = value;        
  }    
 }    
 // Indexer    
 private int[] array;    
 public int this[int i] 
 {        
   get 
   {            
    return array[i];        
   }        
   set 
   {            
    array[i] = value;        
   }    
  }    
 // Automatically implemented property    
 public int MyProperty2 
 {
   get; 
   set;    
 }
}


Best regards
Espen Harlinn
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900