-
Content Count
3586 -
Joined
-
Last visited
-
Days Won
176
Everything posted by David Heffernan
-
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
Erm, yes. -
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
Every function you write that accepts a reference type, you check that it is assigned on entry to the function? -
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
Examples aren't much use without understanding the rationale behind them. If exceptions are a PITA you must be doing something wrong. It's error handling without exceptions that is a PITA. -
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
Reasonable at certain interfaces between modules, but not in every single function. -
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
Why even bother writing those checks? An exception will be raised as soon as you attempt to use the nil instances. -
looking for design ideas for an easily editable list
David Heffernan replied to David Schwartz's topic in VCL
I guess it depends on what motivates you. Do you want to optimise for the quality of your program's UX, or is it more important to you that you can create the UX as quickly as possible, irrespective of how well it works? -
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
It still says exceptions to me. But you say that you don't want to use exceptions. Can you explain why you don't want to use exceptions? -
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
This isn't using exceptions for control flow. It's using exceptions to deal with invalid parameters. If you don't use exceptions, and you show a message dialog to the user then what is code going to do next? How are you going to avoid following the normal execution path. You can exit this function. But what about the caller? And its caller? And its caller? And what about when you run your code through your program's API rather than interactively. Pretty debilitating to show a dialog to an API user. -
handling predicate conditions
David Heffernan replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
Best is to use exceptions of course -
Playing multiple wave files simultaneously
David Heffernan replied to plastkort's topic in General Help
What is more important to you? A solution that works, and 1mb extra exe file size, or no solution and 1mb smaller exe size? -
Depends on your program's requirements and memory usage patterns. What are you trying to achieve with a change of memory manager?
-
Record constants that are actually constant?
David Heffernan replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Attributes are fragile by design. The compiler cannot verify that you supplied the appropriate attributes to make your program work correctly. For example, at the outset of this thread you are faced with an attempt to pass a typed constant to an attribute constructor and the compiler objects. Well, remove the entire attribute declaration and now your program will compile. -
Things that every desktop program should do
David Heffernan replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
VCL styles anybody? -
Record constants that are actually constant?
David Heffernan replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Really? I think that new features are poorly documented, but long standing language features are actually well documented. -
Except that it doesn't work. Doesn't handle errors at all. Also, it's fine that you don't want to disturb your code. But if you are going to offer up code as an example, it should be exemplary.
-
Why do you think ShellExecute throws exceptions? It doesn't. If you want proper error handling use ShellExecuteEx, and check the return value. Even ShellExecuteEx would be wrong here though. Use CreateProcess. As for services, why use cmd.exe to run net.exe? Why not run it directly? Of course, the API is the right way to start a service.
-
Why put up with it. Progressively strip code out until the warning disappears. That will lead you to the duplication.
-
Things that every desktop program should do
David Heffernan replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I don't buy that argument. Your program needs to be able to adapt to changes in screen resolution. When restoring the form layout you must deal with the screen resolution having changed, roaming or not. User can change resolution, font scaling, changes attached monitors, etc. Having said that, I am sure that an argument could be constructed to justify not having such settings roam. In fact, using that part of the user profile that resides on the filesystem allows you to choose between roaming and local on a per setting basis. That's certainly an advantage over HKCU. -
Things that every desktop program should do
David Heffernan replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I understood that HKCU did roam -
Things that every desktop program should do
David Heffernan replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I can't make sense of this. You are implying that HKCU always roams? And that roaming is not appropriate for such settings? -
Things that every desktop program should do
David Heffernan replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
%appdata% surely. But why not the registry? -
Refer to Form Control without using the Form unit?
David Heffernan replied to Mike Torrettinni's topic in VCL
Cyclic dependencies are not necessarily bad. Sometimes they are essential. Try writing a linked list without a cyclic dependency. -
Disaster planning by archiving GetIt installers
David Heffernan replied to Tom F's topic in Delphi IDE and APIs
The issue is not what components you use. The issue is the development process. You need to be able to create development environments in a robust way. These environments need to be identical. And you need to be able to build with different versions of your codebase, including different versions of your components. That isn't something that you get with naive package manager use. Yes. That's pretty much the point. -
Best way to check if an internet SMTP server is available?
David Heffernan replied to Ian Branch's topic in General Help
It's very hard to reproduce the exact series of steps which are undertaken when sending an email. And why bother? Since you have to handle the case when it fails for real, why not use that? The best code is the code that doesn't exist. Can't be a defect in code that doesn't exist. -
Best way to check if an internet SMTP server is available?
David Heffernan replied to Ian Branch's topic in General Help
I expect that if you do that you'll have clients complaining that your program refuses to send mail when it would succeed if it tried to do so.