i am developing a data access layer in c# which will retrive data from multiple datasources. And i want to use the same DAL layer for the java version of my project.
i wonder the point that i should care about to achive this. For the first, i want to know which type i should use for returning a list of objects. Should i consider using List, ArrayList or Array in c# to achive an easy way of converting from c# to java?
Thanks.
(From your comments) It doesn’t matter what the most common list type is. Your DAL should return a type that suits the needs of the consuming code. If you are just going to port the code from C# to Java then you don’t need to think about ‘what is the easiest type to convert’. You just need to use the type which most accurately serves your needs in each language.
Don’t let ‘ease of porting the code’ influence your decision. This may unnecessarily distort your code in both places. IMHO it’s more valuable for the code to make sense in each place and spend a little extra effort in porting the code. Having said that, the choice of return type in each case is unlikely to change the effort required to port the code very much at all.
Even if you are going to attempt some kind of communication between C# and Java then the return type from your DAL should still be driven by the above logic and your communication layer should do any necessary translation into interoperable types.