Wednesday, December 08, 2004

Useless components

I am sure most of you have used components you thought were useless, but what about a component that goal was to be truly useless?

David I is looking for useless componet ideas. He sites a few examples of past useless comonents, and offers some suggestions for new ones.

My idea for a useless component would be one that demonstrated the Heisenberg uncertainty principle.Well at least that demonstrates the common understanding of it that the activity of observing changes the observed(link to very funny comic on the subject). So every time you read a property it changes what it is by an amount.

That in and of itself doesn’t really describe any functionality of a component. If you just had a component with propery that's value changed everytime you read it then it would esentially be a random number generator, which would be usefull.

Maybe you might make some sort of DataSet component that does that.So just reading the values out of the DataSet changes the values stored in the table. I guess we could call it the Heisenberg uncertainty dataset™.

I think that would be truly useless, or at least very anoying!

Delphi 2005 Tour Wrap-Up

We had a pretty good turn out. There were 22 people who confirmed via RSVP, plus some people showed up who didn't RSVP. In the end we only had about 20 people there. There were some people from NETDUG as well as from BSDG, plus a few new faces and once we hadn't seen in a long time.

Since we didn't want to run out of pizza we ended up with plenty of pizza for everyone. I hope everyone got full.

Ander's presentation consisted of a PowerPoint which covered the main points, then he would jump into Delphi 2005 for actual demonstrations. Lots of neat features! It was obvious that most everyone in the room was impressed with what they saw. After each feature was introduced everyone would lean to the person next to them and excitedly talk about it.

Ander's ended up giving away two copies of Delphi 2005. One Professional and one Architect. The Professional edition went to Anthony Fuller - I think this was his first time attending. Maybe he will come back after a door prize like that. The Architect edition went to Kelly Simper from the .NET group. Congratulations guys! I herd a few people offer them cash for their prizes. I picked up a couple extra T-shirts and 25%-off coupons. The coupons are good through the END OF THE MONTH, so get with me before then to get one. I will be out of town tomorrow evening through the end of the week.

If you couldn't make it, or want more information on the features, then you can check the following sources online:

And since I know both Kelly and Anthony are fairly new to Delphi programming, or for anyone else who has Delphi 2005 (or downloaded the free trial), here are some links for learning Delphi.

That should be enough to get you over the initial learning curve.

Tuesday, December 07, 2004

Delphi for .NET: The Book

Got an email from Kim Spilker who is a Product Marketing Manager for Sams and Que Publishing. I will be getting a copy of Delphi for .NET by Xavier Pacheco to review for the group. This looks to be a good book and I generally like Xavier Pacheco's work. I got to meet him at BorCon 2004 as well (at lunch with him and a bunch of other luminaries). If you don't want to wait for the review you might want to pick up a copy today.

If you are really interested in reviewing this book, and can get me one quickly, then I will let you read it first. I'll bring it to a future meeting and you can let me know.

Microsoft PDC 2005

I just got an email from Steve Cellini. He runs the Microsoft Professional Developers Conference or PDC. (Not to be confused with Primary Domain Controller, a very common misconception!)

They just announced that they will be holding PDC 2005 at the Los Angeles Convention Center in Los Angeles, CA from September 13 to the 16 (Pre-conferences September 11 and 12). You can sign up for updates and more details from the PDC site.

I generally hear good things about PDC, although I have never been.

This is in follow up to my original post.

Are you Mocking me?

I previously mentioned NMock for .net mock objects, both as part of my top .net tools and when I was introduced to them back in August. David I just posted to his blog about mock objects, specifically EasyMock for Java and JUnit.

He has some good information about mock objects as well as a number of good links on the subject. Most of the information refers to Java, but we all know that C# and .net is just like Java, only by Microsoft. In other words, the information is easy to adapt. Links of particular interest include the c2.com Wiki and the Mock Objects Wiki.

In the comments David Hervieux pointed out the commercial package POCMock for .NET (also in French).

Monday, December 06, 2004

Meeting Location

Our meeting location is in the Washington Group International headquarters location in the Washington Group Plaza (formally known as MK Plaza) at 720 Park Blvd. in Boise, Idaho. Here is a map:

The red star represents about where the fountain is that marks the main entrance on Park Blvd. Myrtle St. turns into Park Blvd when it crosses Broadway Ave.

Here is an aerial photo of the immediate area with some landmarks marked.

The north-south street to the west is Broadway Ave., and to the south-west (over the river) is The BSU stadium. Park Blvd. runs in front of the MK Plaza, while Front St. runs behind it. The yellow circle is around the fountain at the main entrance. Park just east of the fountain, or most anywhere else in that general area where there is space.

Here is a photo of the sign on Park Blvd. indicating the main entrance. It says Washington Group Plaza now, instead of MK.

Here is a photo of the fountain. Although it runs year round, it will be covered with ice during the winter months.

To the left of the fountain above you can see the large glass entrance behind the flags. This is where to enter the building. Someone will meet you at the security desk and escort you to the meeting room.

Friday, December 03, 2004

Top .NET Developer Tools

James Avery from MSDN magazine published his list of Ten Must-Have Tools Every Developer Should Download Now. It looks like some useful ones for .NET developers. Most of them would work with Delphi as well, in fact NUnit is included with Delphi 2005. Although I doubt Snippit Compiler will compile Delphi code. I'll need to try that. The switchers are decidedly specific for VS.NET. You don't need anything like that to switch versions of Delphi.

His list:

  1. NUnit to write unit tests
  2. NDoc to create code documentation
  3. NAnt to build your solutions
  4. CodeSmith to generate code
  5. FxCop to police your code
  6. Snippet Compiler to compile small bits of code
  7. Two different switcher tools, the ASP.NET Version Switcher
  8. and the Visual Studio .NET Project Converter
  9. Regulator to build regular expressions
  10. Lutz Roeder's .NET Reflector to examine assemblies

I would add the following tools:

  1. Delphi 2005 - if you are not already planning to get it. . .
  2. SharpDevelop for a lightwight IDE (with added features over Visual Studio)
  3. Reflector.FileDisassembler to dump the disassembled code from Reflector
  4. Borland Together Designer Community Edition (free) - Go from requirements to code faster.
  5. Borland Optimizeit Profiler for the Microsoft .NET Framework
  6. NProf the .NET profiler
  7. NMock the dynamic mock-object library

Notice I don't see Visual Studio.NET or Source Safe anywhere on this list? That is because they are the tools you use when you really don't have a choice.

What would you add to this list?

December 2004 Meeting Wrap Up and News

Chris covered SharpDevelop, the open source .NET IDE.

While the demo was great, and there were a number of features and advantages over Visual Studio.NET the overall conclusion was that you are better off using a commercial IDE for most of your projects. Might be a nice additional tool to have in your toolbox.

Randy talked about job descriptions, skills and pay rates. We discussed ways to increase our earning capacity. Pretty interesting discussion.

We finally covered chapters 5 though 8 in Design Pattern's Explained. The book is really easy reading so we are stepping up the pace. Next month (January) we are covering 9 through 17. We will devote more time to it at the meetings.

Didn't get a chance to get to news, so here is what I had left to cover:

Delphi Popularity
Delphi 2005 Launch Tour in Boise
Top 10 Persistent Design Bugs
I would add failure to trim trailing white space from a programming IDE to the list.
Firefox 1 released
Just in case you were living under a rock. In related news IE's popularity has begun a steady decline. Mozilla seems to control between 10% and 20% (or more) of the traffic depending on the site. In other related news, AOL announced the next Netscape to support both IE and Gecko (Mozilla's) engines. If you are interested in using the Gecko engine in your browser you can use the Mozilla ActiveX control that was designed to mimic the IE ActiveX control.
Delphi 2005 without .NET
Want to use Delphi 2005, but could care less about .NET?
Exploring MDD and the future of Development
IBM explores MDD and the future of software development. Might be a good idea to keep your eyes on this trend.
OOPSLA 2004 MDA Panel
More on MDA from the OOPSLA panel, as posted in David I's blog.
User-Centric UI
More information on improving your user interface.
Joel On Software: The Book
Take one popular Blog on software development (and related areas), edit, add some content and you have the new Joel On Software book. If nothing else it is more effective to hit people with when they just don't get it.
US, India, Russia and Ukraine - largest programmer populations
Interestingly Ukraine has the 4th largest programmer population.
EA faces Class Action lawsuit for programmer conditions
Electronic Arts requires seven 13 hour days from their developers. Aren't you glad you don't work in the gaming industry? My question is are you really more productive after about 60 hours a week?
Make Love Not Spam - Lycos.uk's DDoS screen saver against spam
Lycos.uk's launches a screen saver that launches a DDoS attack against spam sites. More effective then expected.
2004 IOCCC Winners Source Code Released
And you thought that code you were supporting was bad. Take a look at this code from the "Winners" of the 17th International Obfuscated C Code Contest. Some of it is actually pretty, but not if you were to try and maintain it.
The Lessons of Software Monoculture
Commentary about a homogenous software culture. It makes it easier for programmers, but also easier for cracker and script kiddies.
Programmers Hold Funerals for Old Code
I guess it can't be that bad of an idea if it gets programmers to get rid of their old code. Some of them just never let it go! (I am guilty of that)
Standards-Based CSS/XHTML Slide Show
A competitor to PowerPoint designed for web deployment. Pretty cool.
Grid Computing: Conceptual Flyover For Developers
What is this "Grid Computing" you speak of, and what does it mean to me as a software developer?
Google Scholar
Google scholarly papers and citations.
JBuilder 2005 Update 1 is available for download
Seems like everyone always waits for the first patch.
Delphi 2005 update 1 comming
Because of yet another last minute "fix" from Microsoft for Internet Explorer Delphi 2005 has some odd behavior on a fully patched machine. This update will address that as well as a few other issues. Should be any day now.

More on Inline in Delphi

Turns out Remco is the person I have been exchanging with about the inline warnings. He isn't too thrilled that he needs to use the {$IFDEF WINDOWS} directive. That is understandable. Most developers dislike the dreaded IfDef compiler directive.

What else can he do? Especially with his "do not use not used units" policy?

You have two other options to get rid of this warning without adding Windows to the uses clause (even though it is already included in your compiled application because you use SysUtils that uses Windows). What the warning is telling you is that although you (or another developer) specified that the function should be inlined, but because of your uses clause it cannot.

You can just tell the compiler to turn of inlining all together with the {$INLINE OFF} compiler directive. This ignores all those Inline directives on your functions. Remove all benefit and annoyance of this new feature.

The other option is the {$INLINE AUTO} compiler directive. This tells the compiler that you trust it to inline functions based completely on its judgment. This also ignores the Inline directives on your functions, but instead of disabling Inlining the compiler just makes all the decisions on its own. Interestingly, if I don't have a carriage return between $INLINE and AUTO then the error insight and Structure panel flags it as an Invalid compiler directive, but it compiles fine. Adding a carriage return fixes it.

Either directive removes the hint about not having the correct unit in your uses clause. {$INLINE ON}is the default compiler directive. This compiler directive is site specific. In other words you would need to added it to the top of each unit you want to change the behavior in. Alternatively you could just surround the procedure that makes the inline call in question with OFF and ON directives. Don't know if that is better then IfDef though.

Wednesday, December 01, 2004

Delphi Inline functions and your Uses clause

Back on More Coding Peeves someone asked me about the warning:

'AnsiSameText' has not been expanded because unit 'Windows' is not specified in USES list
I looked in SysUtils and AnsiSameText is declared as:
function AnsiSameText(const S1, S2: string): Boolean; inline;

So it is in fact an Inline function. The help for the warning explains:

This situation may occur if an inline function refers to a type in a unit that is not explicitly used by the function's unit. For example, this may happen if the function uses inherited to refer to methods inherited from a distant ancestor, and that ancestor's unit is not explicitly specified in the uses list of the function's unit.

If the inline function's code is to be expanded, then the unit that calls the function must explicitly use the unit where the ancestor type is exposed.

Lets take a look at what exactly function inlining is. When you call an inline function what happens at the compiler level is that the actual code of function is expanded at the location of the call instead of a call being made to a function. A call translates into variables being pushed onto the stack, a jump being made, variables being popped off the stack, etc. So if there isn't a lot of code in a function then it makes sense to inline it.

AnsiSameText calls AnsiCompareText which is also Inline. If your are running under Windows then AnsiCompareText calls CompareString which is in Windows.pas. When these inline functions are expanded your call to AnsiSameText is actually becomes a call to CompareString from your unit.

Julian Bucknall has a rant about how the fact that Inline is only a hint to the compiler that your function is inlined. This is why inlining is only a hint. Your unit may not be able to have the expanded code in it because of a type or call that is declared in another unit that your unit does not use.

What does all this mean to you and your "No Hints or Warnings Policy"? Since Windows is used in the SysUtils unit you do not gain anything by excluding it from your uses clause. So put Windows back at the beginning of your uses clause and the warning will go away, and your program should not be any different. If you want to be cross platform compatible then do something like:

{$IFDEF MSWINDOWS}
Windows,
{$ENDIF}
{$IFDEF LINUX}
Types,
Libc,
{$ENDIF}

Excluding the Windows unit from your uses clause is important if you are going for cross platform compatibility, but if you are trying to reduce code bloat then you aren't accomplishing anything since SysUtils calls it directly, in fact that uses clause is directly from its uses clause.