|
I just did something like this for my current project. I created a class with a shared (static) dictionary which contains the dropdown lists. There is also a shared method which is passed the name of the desired list. The method checks the dictionary first and then queries the database if necessary. It's really just a simple data caching class. Not sure if this is considered the "proper" way to do things (I'll leave that to the programming gurus out there) but it's easy to code and it reduces the number of database calls..
Hope this helps,
Joe DiNatale
|
|
|
|
|
Joe DiNatale wrote: Not sure if this is considered the "proper" way to do things
Depends. Did you make that optimization after running a profiler and determining that it was needed?
"premature optimization is the root of all evil." (Knuth, Donald - 1974)
Joe DiNatale wrote: It's really just a simple data caching class.
Do you have any idea how many caching mechanisms already come into play when making database calls? It is entirely possible that your solution slowed down your process.
led mike
|
|
|
|
|
I'd be inclined to use something that does caching properly. Otherwise you'll end up with annoying bugs, like products being added, and your dropdown lists won't show the new products until the worker process is recycled.
If your pages are going slow because of many database round trips, then consider using asynchronous pages.
|
|
|
|
|
Hi All,
I have a dll A which contains functions f1, f2, f3, and i use these functions in my application, say function f4 in my application uses them for some purpose, now the problem is dll A is from third party, and it can have multiple versions in the future?, how can i take care of this issue in my design of Application such that new version of this dll(new version may have more functions or changed function names) doesn't impact function f4, say if new version dll is just extension to previous dll, would it be automatically called by my app, or do i need to take some measure to support new version, please help by considering other similiar scenarios, if i have missed any?, Thanks in Advance!
_____________
princenrj23
|
|
|
|
|
If its a proper, published interface API then future releases should be backwards compatible. There is no guarantee of course, but no respectable company would replace a function with another of the same name that did something totally different. For example, in version 1.1 fuuntion F1(int a,int b) returns a + b would never be replaced with funtion F1(int a,int b) that subtracts them, it just isn't done.
That said, it should be standard practice to regression test whenever you are considering using a new version of any software.
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
It has become increasingly popular to implement Delete functions in such a way that the user will not be bothered with MessageBox confirmations, but will instead be given the option to undo his action. Gmail does it, and this is covered very well in an article at alistapart.com[^].
I've been implementing this in my own projects, and would like some input from others regarding the best design for this. In many cases, the implementation isn't terribly complex: When an entity is deleted, it is simply deleted from a table, but a copy of the deleted entity is stored on the side (for instance in ViewState if this is a web application) and the user given the option to undo his action. If the user chooses to undo, this entity is simply re-inserted into the table. If the user doesn't choose to Undo, this copy will simply get lost when the page is closed, which is very much in line with the user experience (when he closes the page he will probably expect to loose the chance to undo his action).
As I said, this might be OK under some circumstances. But then there are others. For instance, lets assume I'm writing my own blog site, I want the admin to be able to delete blog entries, and I want to implement undo as well. Each blog entry has a unique ID allocated by the database, each blog could then have zero or more comments, where each comment could be linked to another comment (similar to the messages in the CP messageboards). This would be implemented such that each comment has also a unique ID (assigned by the DB), each comment has a BlogID and a ParentCommentID. Blog posts are then linked to using their ID (myblog.com/Blog.aspx?ID=10). Let's assume that the admin now wants to delete a blog entry. By using the implementation given above, several problems arise. First, if the admin chooses to undo the deletion of a blog entry, a new entry would essentially be created, so the BlogID's of each comments would have to be updated. Also, comments would have to be relinked together since each comment would also receive a new unique ID, so all the parent ID's would have to be updated. Both of these tasks are very well manageable, but annoying. However, the biggest drawback lies in the fact that any links to this post are now invalid, since the blog entry wasn't really undeleted, a new one with the same content was created but with a new ID. So this implementation doesn't guarantee that the system is in the same state as it was before the delete/undo combo.
Another implementation could be like this: When an entry is deleted, it is in fact not actually deleted, but instead marked as deleted (this requires a new column in the table, and it requires all get-queries to be rewritten so they don't fetch deleted entries. Again: a bit annoying but perfectly manageable). This means that Undo is much simpler: it simply removes the "Deleted" flag from that row. But the question remains: when is the record actually deleted? Should we maybe not bother with it? Should we implement an "Empty trash" function for the admin as well? And should we implement undo for that as well?
As you can tell I have a LOT of questions. Feel free to answer as many or as few as you like I'm basically checking if I'm missing something obvious, or if anyone has given something similar any thought.
Bottom line: how do you implement Delete/Undo in your (web) applications?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
dabs wrote: would like some input from others regarding the best design for this
Your not asking about design, you are asking about what feature should be implemented. That question needs to be asked for each project based on the project definition.
An admin deleting threads and all it child replies is not at all equivalent to someone deleting text in a word processor.
For this reason I don't believe the Undo is a good fit. A recycle bin where it must be manually deleted or perhaps expired but until then can be restored sounds like a much better use model for an Administrator and that problem domain.
led mike
|
|
|
|
|
Hi,
I've been searching the web for months but although there is a lot of stuff to find about sockets between client and server, I've found very little on designing a protocol to talk over this socket.
For what i need (basic question/response and synchronizing data, which i currently do using xml), there is little to find. And so i learned a lot of hard lessons involving recoding a lot of the app due to stupid errors which i did not forsee due to lack of experience.
Does anyone know some sources for more information about this subject or have a view on protocols for client/server apps? It's my first Client/Server application and I feel like i am in the dark.
|
|
|
|
|
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.
|
|
|
|