|
I opted for extensibility in this case. I spent two extra keystrokes on the infrastructure so it'd be easier to add statements later.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Yes, but anyway you'll have to then change your code to:
if(!curlies)
{
...
return;
}
Unless you want to keep it all in one line. And that was my main point, from a debugging stand-point (maintainability), it's better to put if statements in 2 or more lines... although I think some of today's debuggers highlight the instruction to be executed rather than just the line they're on.
Also, I like the space between the if and the opening parenthesis since it helps to distinguish it from a regular method (for better maintainability).
Regards,
Alvaro
Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.
|
|
|
|
|
It needs to work, therefore be bug free. Number two it needs to be easy to maintain and read in case it is ever useful or used by someone else.
Those are my points and my reasons for my choice.
C++ - Pure, Simple, Makes Sense.
C# - Microsoft's idea of Pure and Simple
|
|
|
|
|
Bugs are a thing that is very common when writing code, so I think number two is indeed the best option to choose first. If your code is easily maintained, you can fix the bugs fast and optimize it easily too.
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
Not only that, it will also be easily extended. And - in response to user feedback - it stands a chance of being a usable piece of software sooner or later
|
|
|
|
|
diilbert wrote:
It needs to work, therefore be bug free.
Experience has taught me, that working software and bug free software aren't the same thing. Bug free real-world software is impossible, unless you have a rather narrow definition of what a bug is.
Michael
CP Blog [^]
|
|
|
|
|
I suppose there will never be a bug free product. It just depends on how you look at it. I look at bugs as something an average user will come across when using the software. If the average user finds a problem the software is not working the way it should.
C++ - Pure, Simple, Makes Sense.
C# - Microsoft's idea of Pure and Simple
|
|
|
|
|
diilbert wrote:
C++ - Pure, Simple, Makes Sense.
C# - Microsoft's idea of Pure and Simple
I like your signature, but in all fairness, C++ is not exactly pure, and is anything but simple.
|
|
|
|
|
Nemanja Trifunovic wrote:
C++ is not exactly pure
class C {
C operator++(int) = 0;
}; How about now?
Software Zen: delete this;
|
|
|
|
|
Definitely not simple.
Regards,
Alvaro
Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.
|
|
|
|
|
Pure: free from what vitiates, weakens, or pollutes
Simple: free of secondary complications
Sense: implies a reliable ability to judge and decide with soundness, prudence, and intelligence
Makes sense to me anyway
C++ - Pure, Simple, Makes Sense.
C# - Microsoft's idea of Pure and Simple
|
|
|
|
|
It all comes down to the fact that I hate writing C#, and do only when I have to.
C++ - Pure, Simple, Makes Sense.
C# - Microsoft's idea of Pure and Simple
|
|
|
|
|
Why do you hate writing C#?
If it's because you still love C++, I have to tell you that I don't miss it much. I don't miss the pointer/reference notation (->, *, **, &, &*), or dealing with character strings, or double-wide character strings, or BSTRs, or header files, or _tcslen, or push_back, or memory leaks, or not being able to initialize member variables where they're declared, or not being able to invoke a constructor from another constructor of the same class.
What I do miss are templates (a lot), multiple implementation inheritance (a little), and default parameters (sometimes). But templates (known as generics) are coming in .NET 2.0 and they'll fill in the void for most cases.
Regards,
Alvaro
Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.
|
|
|
|
|
Alvaro Mendez wrote:
What I do miss are templates (a lot), multiple implementation inheritance (a little), and default parameters (sometimes).
I miss all of these, but most of all I miss RAII[^]. And keyword using is not filling the void.
|
|
|
|
|
Nemanja Trifunovic wrote:
And keyword using is not filling the void.
Really? It fills the void quite nicely for me.
You implement IDisposable, put your cleanup code inside the Dispose method, and let using write all the try/finally code for you. It's probably as close as you can get to RAII in a garbage collected language. I use it extensively, especially for things like showing a wait cursor:
using (Cursor.Current = Cursors.WaitCursor)
{
}
Regards,
Alvaro
Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.
|
|
|
|
|
The answer depends on the "mission-criticalness" of the project. MS can get by with still having bugs when the software is released. NASA, Boeing, or some place like that can not because someone's lives could depend on the successful execution of the code. They do not get to release "service packs" that make everything ok.
|
|
|
|
|
Couldn't a jet receive an update whilst in the air?
|
|
|
|
|
don't think so, it would probably need a restart :p
Clean Programming Under Difficult Circumstances
|
|
|
|
|
|
hmmmmmmm
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
Marc Clifton wrote:
Writing less of it for more $$$
Absolutely. My overall aim in my life is to develop software without having to write one new line of code. We are still a million miles off that, but maybe one day.
Michael
CP Blog [^]
|
|
|
|
|
Bloody hell Butler, you sound like an advert for the next Visual Studio .NET... :P
I don't think the future is whether we write more or less code, it is the kind of code we write. I am fed up with having to write SqlConnection sqlconMain = new SqlConnection(ConnectionString); everytime rather than Get Customers With Debt from Main Database or some such.
Why are we still writing structs and namevaluepairs and pointers and byte arrays?
As an example; Right now I can use Dreamweaver to visually whip up XHTML compliant web-pages without writing a single line of code. They are as good as my hand coded ones, but I am quicker at hand-coding those pages than I am at dragging fiddly floating DIVs in Dreamweaver. Even with practice I won't drag right-floating DIVs faster than I can type div#News {float: right;} .
regards,
Paul Watson
Bluegrass
South Africa
Ian Darling wrote:
"and our loonies usually end up doing things like Monty Python."
Crikey! ain't life grand?
|
|
|
|
|
Paul Watson wrote:
Bloody hell Butler, you sound like an advert for the next Visual Studio .NET...
It was more of a subtle plug for the work Marc is doing with MyXaml... well that was my intention.
Paul Watson wrote:
I don't think the future is whether we write more or less code, it is the kind of code we write. I am fed up with having to write SqlConnection sqlconMain = new SqlConnection(ConnectionString); everytime rather than Get Customers With Debt from Main Database or some such.
Actually, I'm fed up with having to write a customer database. I'd much rather be able to use the database that comes with Outlook or with Sage Accounts than having to build me own. Why is it so hard for use to be able to integrate with each others applications. Why isn't there a standard component that can be bought that provides the basic customer information that I can plug into my own app and just add my custom fields.
Why can't I easily hook the Make Call functionality of Outlook and redirect it to call my telephony code. Why can't I easily add a Dial button into the Sage Account screens and have it call my code.
Why should I have to write something that somebody else has already done, that my customer is already using but wants to make it do something just slightly different to fit in with their business methods.
We need to stop thinking of computer software as seperate applications and start writing software as platforms for others to build on. Hardware is component based, so why isn't the software built the same way. I want sofware plug and play.
Michael
CP Blog [^]
|
|
|
|
|
Completely agree, Michael. I just don't want people thinking the future is not to write a single line of code. When you use MyXAML you are writing lines of code, nice code but still code IMO. The way MS and others make "no code" out to be is drag and drop visual wizardry which makes re-use and system-wide consistency difficult.
regards,
Paul Watson
Bluegrass
South Africa
Ian Darling wrote:
"and our loonies usually end up doing things like Monty Python."
Crikey! ain't life grand?
|
|
|
|
|
Paul Watson wrote:
When you use MyXAML you are writing lines of code, nice code but still code IMO.
I don't really see MyXaml as 'code' in the traditional sense. Just like I don't consider HTML as code either.
Declarative Programming is certainly the future as far as I'm concerned.
Paul Watson wrote:
The way MS and others make "no code" out to be is drag and drop visual wizardry which makes re-use and system-wide consistency difficult.
There are certainly problems with the current wizards and code generation tools, but I think a lot of these can be overcome. And they must be overcome because 'typing' the same code over and over like your SqlConnection example is a waste of development time.
In my attempts to retool my business to be aimed at supplying software solutions to smaller businesses instead of (the now crapped out market) for larger firms, where I can no longer 'afford' to charge by the hour for development time, I have realised that only way forward is to completely rethink my traditional development methods. I've always had a dislike for auto-generating of code and drag and drop programming but I now thing that tools that reduce the development time and development costs are the only way forward.
MyXaml (another plug ) has started to help me achieve my goals. I now have a base CTI package that can be customised by altering the markup and the code-behind file without having to write lots of new code to achieve customers goals. (.NET has helped a lot too)
And now if I can get my MxCRUD stuff finished, I'll have the data input/access cracked too. This is the first place that I need to create a code generation tool, because it is a pain in the ass and time consuming to create the necessary StoredProcedure parameters markup. (Not as bad as having to write the actual code but still a waste of valuable development time)
And I've now got a few ideas on how to get towards the goal of 'Get Customers With Debt from Main Database' rather than having to write the archaic data-access code that we all hate doing but still find ourselves writing for each project we do.
Michael
CP Blog [^]
|
|
|
|