|
A 'Protocol' is nothing more than an agreed upon conversation.
When you walk up to someone and say hello and expect a hello in response you have a protocol.
You are free and open to do what you want really but since you are shuffling files back and forth perhaps you want to look at an established file transfer protocol. Loop up RFC 959 for FTP[^] and start reading.
|
|
|
|
|
Hmm.. I understand that. Seeing I come from a system administrator background I have enjoyed reading a couple of the RFC's in the past
However: I am not transmitting files over the socket.
The actual question is: are there gotcha's in protocol design (for instance i found out that having an <eof> parameter to let the client detect when the command is done is an abolute must).?
|
|
|
|
|
Noctris wrote: are there gotcha's in protocol design (for instance i found out that having an parameter to let the client detect when the command is done is an abolute must).?
Not sure what that means.
Noctris wrote: It's my first Client/Server application and I feel like i am in the dark.
Not unusual, it's a large subject.
Noctris wrote: I've found very little on designing a protocol
Yeah I don't remember ever seeing anything like that. Try looking at existing protocols rather than looking for something that teaches protocols. I suggest you start with some simple application level protocols like HTTP/FTP/POP3 of course...
Noctris wrote: what i need (basic question/response and synchronizing data, which i currently do using xml)
That sounds like SOAP so you may not need to create your own protocol. It's difficult to say for sure with the limited information you provided.
led mike
|
|
|
|
|
Hi!
I'm looking for an approach for creating server data presentation (input) on client side.
I have a client application (Delphi) and server application ASP.NET.
Server can get different set of data (text, date, true/false etc).
Server can change required data set and than client should react on that change by changing controls for server data presentation.
So the question is: Are there any approaches or existing technologies to support such client-server interaction.
I suppose that it may be done via some intermediate user creating language in some xml format for example. But there are many others questions in such an approach:
How to create control events handling routines? (For example validation, etc)
|
|
|
|
|
I don't find any question in your post related to your subject line. You seem very confused about pretty much everything. I suggest that an internet forum is the wrong format for solving your problems. You need some good books or something.
led mike
|
|
|
|
|
Hi,
I've been coding in .NET and Java and C++ for a few years now and I still haven't
quite got my head round Association ,Aggregation and Composition.
I know a the difference conceptually, eg. A Bank *has* branches (Aggregation), eg. A Child *has* a toy (Composition).
The thing that confuses me, is when it comes to coding the relationship.
I've looked at examples on the Web and it still confuses me.
C# and Java
public class Boy
{
public void PlayWith(Toy toy) {toy.play();}
}
public class Bank
{
List<branch> branches = new List<branch>(2) {new SydneyRdBranch(); new ParisRdBranch(); }
}
</branch></branch>
Please could someone explain how to write Association, Aggregation and Composition in Code please.
Many Thanks
Tom
|
|
|
|
|
AFAIK association encompasses both aggregation & composition, the difference between composition and aggregation is that with composition when the containing object goes out of scope then so is the composed object for example a car is composed of an engine once the car goes out of scope the engine goes with it.
In contrast aggregation means that the even when the containing object goes out of scope the aggregated object still remains for example a car could have a driver if the car goes out of scope this doesnt mean that the driver object will.
It really boils down to whether the object in the contained object is created inside or passed in, your Boy example is Aggregation as the Toy is passed in, and the Bank example is composition as the Branches are created internally
hope this helps
|
|
|
|
|
Just explanaing further..
Toy example is Aggregation.
As Toy instance is created out side the scope of Class Boy. So deletion of object of Boy will not make impact of object of Toy.
Bank has composition relationship with BankBranch.
Since instances of BankBranch created inside scop of class Bank so if object of Bank goes out of scope then objects of BankBranch will be get deleted (destructor of Bank must be delete objects of BankBranch)
Akash
|
|
|
|
|
a boy has a hand : composition, there is no hand without the boy.
an appartement has a building : composition
----------------
in contrast :
a car has a driver: aggregration
|
|
|
|
|
Is anyone using this, and if so, what have your experiences been like so far?
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Unity - opinions are divided.
|
|
|
|
|
I'm unanimous on this, as I've told you before (when there was some animal in your reply).
|
|
|
|
|
Luc Pattyn wrote: I'm unanimous on this
Why thank you Mrs Slocombe.
|
|
|
|
|
I currently have a sizable code base with LinFu that I can't afford to rewrite from scratch, and I want to increase the code coverage rate on existing portions of the library which don't have any coverage at all. Is there any way to apply unit tests to existing code and increase the coverage rate, or is this an exercise in futility?
|
|
|
|
|
Philip Laureano wrote: Is there any way to apply unit tests to existing code
Couldn't you use LinFu to do that?
I just spent like two minutes looking at your LinFu and that was the first thing I thought of. Also though, I have used NUnit for several years and I find the quote above from you a bit confusing because of course you can apply unit tests to existing code. I must be missing something.
led mike
|
|
|
|
|
led mike wrote: Couldn't you use LinFu to do that? [Confused]
I just spent like two minutes looking at your LinFu and that was the first thing I thought of. Also though, I have used NUnit for several years and I find the quote above from you a bit confusing because of course you can apply unit tests to existing code. I must be missing something.
Hi Mike,
Sorry for the confusion. This question is more of a philosophical question rather than a technical one, so I'll go ahead and rephrase it: "Should unit testing be applied to an existing code base that already works?"
If the rest of the code base changes very little, wouldn't the tests themselves be a case of YAGNI?
led mike wrote: Couldn't you use LinFu to do that?
I suppose LinFu could "dogfood" itself and put the tests everywhere, but that's beside the point. The real question here is that is there really any value (read: value = quality) gained in adding unit tests for code that has already been proven to work on an innumerable amount of occasions?
|
|
|
|
|
Philip Laureano wrote: The real question here is that is there really any value (read: value = quality) gained in adding unit tests for code that has already been proven to work on an innumerable amount of occasions?
If you're never ever going to change the code again - no. If there's the possibility that the code could change - yes. The unit tests will help give you confidence that your code still works post changes, which is (obviously) hugely important.
|
|
|
|
|
Philip Laureano wrote:
If the rest of the code base changes very little, wouldn't the tests themselves be a case of YAGNI?
Why not simply add the tests once you do need to change the code?
As you say, if it won't change then it's pretty pointless.
On the other hand, you might find a bug or two in the existing code if you add tests.
|
|
|
|
|
I hope somebody can offer me some guidance as I'm a little stuck and not sure what exactly to do.
I have a nicely designed system that has utilised a couple of abstract classes which then have concrete classes implementing them.
I'm using the base classes to encapsulate functionality that is applicable across the objects but only use the concrete classes in the application with each concrete class being used in a specific way (so that you wouldn't swap one out for the other)
I've run into an issue unit testing, trying to use [Moq] as it is unable to mock a class that inherits from an abstract base class where the methods and properties are not virtual.
The only way out of the situation is to either create interfaces specific to each of the classes that inherit from the abstract base (which seems pointless to me, since I'd implement an interface, have current concrete class implement the interface and then replace all instances where concrete class was used with interface) or I have to mark the methods and properties of the base class as virtual and cause a performance problem.
I don't like either option and wondered if anybody had come across a similar situation and how they had resolved it?
|
|
|
|
|
I'm confused by the title, if you had been writing this system using TDD you would not have the issue because you would have designed your classes with testability in mind.
Also it's not Architecture vs TDD they aren't conflicting by any means I practice TDD and have found it a good way to design you generally end up with objects that are loosely coupled and because of the code coverage gained you can perform constant refactoring leading to an architecture that evolves more easier
|
|
|
|
|
The issue I'm having is that I am unable to use the testing technology that is available to enable me to adequately test the system by isolating each layer.
To be forced to have to use interfaces where there really is no need has a 'smell' to it.
The system wasn't Test Driven Design, it was designed using normal OOP techniques and it is only trying to use Test Driven Development techniques that I have run into problems.
I have found one solution and that is TypeMock which will happily mock a class that has an abstract base class the only downside being the cost.
Having spent a fair amount of time looking at Mock 'products' it seems to me that for the most part you end up having to sacrifice legitimate design choices or alter code so that it can cause performance penalities (such as marking methods/properties as virtual) in order to be able to test.
I haven't come up with any answers and am more than happy to hear other peoples opinions about this.
|
|
|
|
|
Mock objects are designed to be used up front. Attempting to apply them at the end of a development is pretty much a futile issue.
|
|
|
|
|
Can you please elaborate on why?
In a well designed system with good separation of concerns it should be easy to use Mock objects, is it not simply that generally the technology we have in .Net to support mock objects is not up to the task?
|
|
|
|
|
Lowest of the Low wrote: In a well designed system with good separation of concerns it should be easy to use Mock objects,
Well - if you've used techniques such as Inversion of Control then, yes, Mock objects should be fairly easy to use. However, most systems are developed against timescales where good practices like this go out the window. Those that don't tend to have been developed with TDD up front, so the actual mocking has been done well beforehand.
|
|
|
|
|
Lowest of the Low wrote: or I have to mark the methods and properties of the base class as virtual and cause a performance problem.
What kind of application are you building?
I'm willing to bet money that you will not notice any difference at all if you go virtual unless you are building some extremely processor intensive algorithm stuff.
Anyway, there are other mock frameworks that allow you to do what you want.
(eg, Typemock , but that one is commercial)
There are also two kinds of mock usage:
1) You use the mock as a stub just to return test data for you.
Eg, you want your DAL class to return some dummy list of customers to your business layer.
2) You do interaction tests, you want to see that classes communicate correctly.
Eg, you might want to test that a business class calls your logger class under certain conditions.
(http://martinfowler.com/articles/mocksArentStubs.html)
The first case is is easy to do with mockframeworks that requires virtual or interfaces.
Since if you need a stub you need to create some sort of interface anyway..
So in this aspect Pete is completely right.
In the 2nd case, you want to make sure that a certain call flow occurss under a certain condition.
In this case you do need to have actual code that interacts, and the mock framework should simply ensure that certain methods were or were not called.
This can also be done with virtual/iface mocks, but they are not always enough, eg, they can not ensure that a static method was called.
So in this aspect you are better off using a mock framework that can intercept any type of call.
(One could argue that static methods are ugly and you should design your api so that you do not need to test if a static/private/non virtual method was called, but that is a whole different story )
|
|
|
|