Niel, Marcel,

Thanks for your answers. You've hit the mark!

- Joel

________________________________________
From: Neil Bartlett [njbartl...@gmail.com]
Sent: Friday, April 17, 2009 6:13 PM
To: users@felix.apache.org
Subject: Re: Best Practices?

Hi Joel,

1) Yes, separating interfaces from implementations is a very good
practice, for a number of reasons. From my point of view the biggest
benefit it is allows the API to evolve at a different rate than the
implementation.

Sometimes an API does have a natural "default" implementation. Even
then, implementations _always_ change more rapidly than APIs. If you
separate the implementation from the API, then you can update the
implementation without having to update the API.

2) Services are POJOs. To test services you can get a long way just
using straightforward JUnit test cases, directly instantiating your
service objects from test cases, wiring them up to mocks and so on.

In other words, a true unit test shouldn't involve any OSGi! However
for integration testing you could look at tools that allow you to
quickly spin up an OSGi runtime and test a few services in concert.
For example the PAX Exam
(http://wiki.ops4j.org/display/paxexam/Pax+Exam) may fit your needs.

Regards
Neil


On Sat, Apr 18, 2009 at 12:43 AM, Joel Schuster <jo...@navsys.com> wrote:
> I've done some looking around for some best practice guidelines. Can't find 
> anything other than speaking to standard software methodologies. Not really 
> clear examples.
>
> Anyhow, I have two questions about how people do things.
>
>
>  1.  Is it a good idea to separate Interfaces and Implementations into 
> separate bundles. In my case there are a number of possible implementations 
> for certain service interfaces that may come along in time within my 
> development group. If I include the Interface in my first implementation 
> bundle then new implementations of that interface will either have to have a 
> dependency to my first implementation or be included together with the other 
> implementation. Neither of these seem like good ideas. So my thinking is to 
> create a number of small bundles that include only the interface, or one 
> bundle with all the interfaces. However, one of the best practices I did find 
> said something about not creating huge dependency trees.
>  2.  What do people do to set up unit tests for their services? JUnit? I 
> started going down the track of creating a test interface that could be 
> queried by a 'testing service'. It would look for all implementations of that 
> testing interface and run all the tests. It then occurred to me that there's 
> got to be something out there that already does something like this. Of 
> course the problem with this way of looking at things is that only the 
> exposed (exported) services/packages could be tested.
>
> Thoughts?
>
>
> _________________________
>
> Joel Schuster
>
> The NAVSYS Corporation
>
> 14960 Woodcarver Road
>
> Colorado Springs, CO 80921
>
> 719-481-4877 ext. 138
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to