Tuesday, November 30, 2004

Getting Rid of Delphi Warnings

Someone asked how to get rid of the Delphi warning:

"Unsafe typecast of 'Pointer' to 'TObject'"

The purpose of the "Unsafe" warnings is to let you know your code will not be easily compatible with .NET (or other safe platforms). If your target platform is only going to be Win32 then you can use the compiler directives:

{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
Also worth noting are the platform warnings. These were originally to let you know if your code was going to be compatible with Linux. So if you are only targeting Win32 (or any specific platform) you can disable these warnings with:
{$WARN SYMBOL_PLATFORM OFF}

These are also accessible via the Project / Options / Compiler Messages screen. Generally you should only disable a warning if you know it does not apply to your specific program. I should hope no-one ever disables all hits and warnings.

If you want to know the compiler directive version of the warning then just look in the project .cfg file for the -w lines added when you enable or disable a warning. Then just append {$WARN in front of it and OFF|ON} after it for most of the warnings.

Monday, November 29, 2004

Delphi Popularity

There has been a lot of fuss about the latest TIOBE Programming Community Index for November 2004. The first I noticed was David I's post, then Steve pointed out a post on Slashdot titled "Delphi Renaissance". Both commenting that Delphi has four green arrows (indicating a lot of growth). In fact the TIOBE site has a blurb about it as well. They actually asked Dr. Bob what his take on the growth was. One point everyone is missing is that these stats have shown that Delphi has been growing for a few months now, and all this growth is from before the Delphi 2005 release!

Here are the November numbers:

PositionDelta 1 YearProgramming LanguageRatingsDelta 1 YearStatus
1C17.992%+0.99%A
2Java14.804%-8.28%A
3C++13.865%-2.45%A
4(Visual) Basic10.529%+3.12%A
5Perl9.726%+2.04%A
6PHP7.586%+4.02%A
7Delphi/Kylix5.310%+3.77%A
8Python5.200%+3.43%A
9SQL3.003%-0.69%A
10C#1.504%-0.40%A
11JavaScript1.195%-0.72%A
(The top 11 since I don't consider SQL a programming language)

Delphi 2005 was released just at the beginning of November, so this data that was collected based on data before November will not show any activity from the release. So we should see Delphi really take off next month when these numbers include activity after the Delphi 2005 release.

If I were to attribute anything to these high Delphi growth numbers I would attribute BorCon 2004 and all the blogging. There were blogs created just for covering BorCon. So I guess since Delphi 2005 ( aka Diamondback ) was the central theme of BorCon I guess it could be the source of this growth.

It is worth noting that the author of this report removed Pascal from the Delphi / Kylix data for the first time this month. This means that the numbers are actually reduced from what they would have been had Pascal not been seperated out.

I did a write up on these numbers, in combination with some performance data, back in August. Then I pointed out that Delphi and Python were both growing like gangbusters, while C# was declining in popularity. I think Delphi only had a two or three green arrows then, while Python had four.

Wednesday, November 24, 2004

Some Answers to TDD

Test Driven Development (or TDD) is a programming methodology where you write a test for a feature, then write code that passes that test. Julian Bucknall shares some of his answers on TDD in his Blog.

TDD is something I am really interested in and am advocating. I think methodology is a lot more important then language, framework or platform when it comes to programming. I am reading Pragmatic Unit Testing in C# with NUnit By Andy Hunt, Dave Thomas. It provides a lot of good information on the subject. I'll have a book review here soon. I am also looking at picking up the new Unit Test Frameworks by Paul Hamill next.

David I on Software as a "Living Entity"...

David I. has another interesting post on Software as a "Living Entity".... It reminded me of the book The Little Black Book of Computer Viruses by Mark Ludwig. It talked about viruses as artificial life. You can really have fun with viruses since you need to consider this life cycle and self replication or it will really bite you!

Please note I don't advocate the use of viruses for distractive activities.

I guess that book was replaced with the The Giant Black Book of Computer Viruses which is also by Mark Ludwig. He has other works on viruses if you are really interested.

More Coding Peeves. . .

David I has a post about Coding Peeves. I agree with most of the ones he posted. Here are a few of mine he missed. If you see yourself here don't take it personally. I know I am opinionated. It is part of what makes me interesting! I imagine that some of my coding habits may annoy others, but they will learn to appreciate them.

1) try except blocks with nothing in the exception handler (or just a comment saying "ignore all exceptions"). For really small blocks (like one or two lines) this is can be tolerated, but is really undesirable. Too many times I see a whole screen full of code and an empty exception block. If they want to ignore a specific class of exceptions then they should only trap and ignore that class, but they should be as specific as possible. It is arrogant of the developer to assume they know of every possible exception that could be raised, and that none of them are important. I don't know how often I am tasked with tracking down some odd behavior only to discover the original programmer ignored the exception because they didn't expect this particular one. That is the thing about exceptions, they aren't always expected!

2) Failure to use classes, functions and procedures. Some programmers believe "code reuse" means copy, paste, modify. Maybe the still think their performance is measured on lines of code.

3) Ignoring compiler hints and warnings. Sure, it still compiles, but they are there for a reason. It is really bad when it has gotten out of hand on a really large project, then even if you want to eliminate the ones in the code you are working on you will have a hard time finding them. I personally have a no hints or warnings policy. If there is one I don't know how to clear then I comment it as such, although I have always discovered how to clear them later.

4) Overly strict adoption of Hungarian or reverse Polish notations. When you have complex objects you are working with these notations just turn your variables into alphabet soup! A name variable is a comment about what it contains. Using a notation that denotes the type is like a comment of "set I to 1" - it is redundant. The compiler knows the type and the IDE will tell you.

For example:

Lets say you have a OracleDataReader that is reading sales data. Now what makes more sense: oraDtaRdrSls or SalesData, let alone which is easier to type or refer to in conversation! Although I will allow that some people do like alphabet soup. Maybe that is what we should call the notation.

Another things to consider is if you later change the types of your variables then you need to rename all your variables. Good thing Delphi 2005 has built in refactoring! Time to give those variables in that code you inherited a meaningful name!

5)The use of single line comment characters over multiple lines. I think this is a favorite of the alphabet soup types who like typing extra meaningless characters. Plus if I need to go edit or add to the comment later then I have to worry about where the line breaks and adding new comment marks on each line.

For example:

// We take the integer variable I
// and set it to the value of 1
// oh, and Hi Mom!

vs.

(* We take the integer variable I and set it to the value of 1 oh, and Hi Mom! *)

That should do it for now. Hopefully no one gets me started again.

Tuesday, November 23, 2004

Delphi 2005 Launch Tour in Boise

Anders Ohlsson is coming to Boise as part of the Delphi 2005 US Launch Tour.

He will be here December 7th at 7 PM. This is in addition to our normal December meeting on December 2nd. This visit is jointly sponsored between BSDG and NetDUG.

Anders will be giving away a copy of Delphi 2005 to one lucky attendee, and there will be a discount and T-Shirts available for everyone else. We are getting our Christmas a couple weeks early this year! I expect this to be an incredible demo of a great product. Anders is a great presenter and always a lot of fun.

The meeting location is at our normal Washington Group International location, but we will be meeting in the large training room. It holds 120 people, so bring your friends! If you know any other devlopers get the word out and invite them too!

Delphi 2005 does Delphi for .NET, Delphi for Win32 and C# development. One of the really cool features it includes is Enterprise Core Objects II (ECO II). ECO allows you to build your .NET programs using a model driven approach. It both forward and backwards engineers existing databases and applications. You may recall that Rational said the next version of their product will support OCL (Object Constraint Language). Well, the last version, and this version of ECO both support OCL. This is the future of software development, and you can see it here on December 7th.

There will be updated directions with photos but I wanted you to mark your calendar now.

Factorials, Combinations and Permutations

A while back on the TDAG list Bob Murdoch was trying to figure out Combinations in Delphi. I wrote this code for him and anyone else who is interested. Combination needs Factorial, and I decided to through Permutation (which also needs Factorial) in for good measure. I added an optimization in on Combination that requires an additional parameter (AStop) on Factorial. (Thanks to Brian Mayland for pointing out a bug in my optimization.) If you are calling factorial directly then just leave AStop as 0 [Zero]. If you wanted to you could have an overloaded version of Factorial instead of using a default parameter.

The code is available under MPL or LGPL.

[.html] [.pas] [.zip]

Friday, November 12, 2004

Free Programming and Computer Science Books

Free Programming and Computer Science Books has quite a collection of books to choose from. Everything from the 1971 "How it works: The Computer" to "The .NET Developer's Guide to Windows Security" (All electronic books unless you print them out yourself.)

It is worth checking out!

UPDATE: There seems to some dispute on the copyright of the "How it works: The Computer" book, so it may be taken off-line. I guess it was printed in England and their copyrights work differently. Maybe the 1979 edition will be taken off line and we will just have the 1971 edition. So be warned that these links may die.

Tuesday, November 09, 2004

Delphi 2005 White Papers

Cary Jensen of Jensen Data Systems, Inc. has created a Borland® Delphi™ 2005 Reviewer's Guide (PDF) that covers pretty much everything you want to know about Delphi 2005 (FKA Diamondback). There are 121 pages full of screen shots and details.

There is also a Borland Delphi 2005 overview (PDF) by Jeremy McGee of Bassett Data Systems. It is a little lighter weight at 28 pages.

Update: Dr. Bob has a What’s New in Delphi 2005 article on BDN. This one is in good old HTML instead of PDF. It also looks like it is written with the released version of Delphi 2005 and not the preview version.

Friday, November 05, 2004

Peer-to-Peer: Harnessing the Power of Disruptive Technologies

Peer-to-Peer

Harnessing the Power of Disruptive Technologies

Edited by Andy Oram
ISBN: 0-596-00110-X
448 pages

http://www.oreilly.com/catalog/peertopeer/

Review by Jim McKeeth

Last year I spoke at BorCon 2003 on the topic of Peer-to-Peer networks.  This book was invaluable in gaining a greater understanding of the history, culture and technology of Peer-to-Peer.  Just like Open Source, Peer-to-Peer is more then a technology or a network- it is a culture.

This book is a collection of essays by luminaries who are changing the shape of peer-to-peer.  Each essay talks about both the why and how of the network they are familiar with. 

The book is split into three parts.  Part one is Context and Overview and it covers exactly that.  Provides a history of Peer-to-Peer and defines the term.   Then it looks at where Peer-to-Peer is going in the future.  It does an excellent job of putting it all into context and setting the reader up for the other two parts.

Part two is about Projects and covers 8 different and distinct projects, some of you have heard of and some you may not even consider Peer-to-Peer.  Each project is explained and how it fits into the concept.  Projects covered: SETI@home (it is P2P because the excitement is at the edges!), Jabber, Mixmaster Remailers, Gnutella, Freenet, Red Rover, Publius and Free Haven.

Part three is the real meat of Technical Topics.  It is important to understand the context of P2P and current projects before getting into this chapter.  Each chapter deals with an element that is common to most networks and where applicable gives examples from common networks. 

You will find that a lot of what is covered can be used in other projects as well.  Peer-to-Peer is a revolutionary way of thinking about communication and networks.  Applying these new methods and techniques has benefit outside the traditional realm of "file sharing".  Topics covered: Metadata, Performance, Trust, Accountability, Reputation, Security and Interoperability Through Gateways.

While it is technical don't expect code samples.  If you already know how to program then it will provide you with the information you need to adapt those skills for P2P projects.  As a programmer I was expecting more technical details and more of the hard topics to be addressed.  Although that is not what I found I still enjoyed the book immensely. 

Overall this book does a great job of combining the culture and technology of Peer-to-Peer in a book that is accessible to anyone who is interested in the subject - programmer and layman alike.  Andy Oram did an excellent job choosing articles and arranging them in a very compelling manor. 

Google Hacks

Google Hacks

100 Industrial-Strength Tips & Tricks

By Tara Calishain, Rael Dornfest
ISBN: 0-596-00447-8
352 pages

http://www.oreilly.com/catalog/googlehks/ (with sample hacks!)

Review by Jim McKeeth

Google is the Kleenex or Xerox of Internet search engines.  No one says to use a search engine anymore, they just tell you to Google it.  I am almost afraid to count how many times I use Google in a given day.  How wonderful it is to have a collection of powerful tips and tricks for the mainstay of internet searching. 

This book goes beyond hacking Google though.  The goal of the book is enable the reader to find what they are looking for on the internet.  Google just happens to be the best way to do that most of the time, but when there are situations where you are better using other means the book will tell you when and how.

Since Google is so ubiquitous with everything to do with the internet this book could also be called Internet Hacks.  In all honesty, if you want to get the most out of the internet everyone already knows you need Google.  But if you want to get the most out of Google you also need this book.  Commit it to memory (or get the Google Pocket Guide).  There will be a test.

The book starts out with some basics, but you will be surprised how much of the basics you don't know.  The basic tips can be some of the best ones since they are the ones you will use all the time.  Take for example Hack #5 - Getting Around the 10 Word Limit.  Did you know Google was limited to 10 words in your search?  Did you know there were ways around it? Or Hack #6 - Word Order Matters.  Just the simple act of placing your words in the right order can improve your search results. 

While there are only 100 "Hacks" you will find that each hack is filled with many tips and tricks.  It is surprising how much detail the hacks go into.  When a code sample is applicable they provide one (or more).  And there are hacks for everything.  Starting with searching, covering the Google Web API, and ending with everything you wanted to know about Page Rank for the web master in all of us.

There are 8 chapters:

  1. Searching Google (28 hacks))
  2. Google Special Services and Collections  (7 hacks)
  3. Third-Party Google Services  (5 hacks)
  4. Non-API Google Applications (9 hacks)
  5. Introducing the Google Web API (10 hacks)
  6. Google Web API Applications (25 hacks)
  7. Google Pranks and Games (7 hacks)
  8. The Webmaster Side of Google (8 hacks)

If you live, work or play online then this book is truly indispensable.  I can't wait to read Google: The Missing Manual since I cannot think of anything this book didn't cover.

Book Reviews

This page provides a link to book reviews by members of the group. It will be updated as new reviews are posted.

Programming .NET Components By Juval Lowy

Programming .NET Components

Programming .NET Components

By Juval Lowy

O’Reilly
April 2003
0-596-00347-1, Order Number: 3471
480 pages

Review by Christopher Brandsma

When I was reading the first three chapters of this book I could have sworn that it was miss-titled; it should have been called Component Oriented Programming in .NET. Just so we get this straight, this is not a book about the wonderful components in the .NET Framework that Microsoft has provided -- this is a book about CREATING components in the .NET Framework.

The next item that needs to be clarified: What is a component? If you are from the Delphi/VCL world, a component is a non-visual object that can be manipulated in design-time with the mouse and the property browser, while usually being dragged onto a form (TTimer, TDatabase, TSession, TTable, etc). But in this book a component is a class -- the simpler the class, the better. No inheritance unless absolutely necessary, no class hierarchies, but interfaces are cool.

Now, once you get beyond the philosophy lessons of the first three chapters, you are left with one outstanding book on practical .NET development. The chapter on Events is worth the price of admission alone. The chapter on Versioning is excellent as well, but the rest of the sections are every bit as good.

Many of the topics covered in the book are not things you will find in the help files, or if they are, they are too scattered to be useful. What is covered: a large number of best practices, defensive coding techniques (again the chapter on Events is gold), and general you-really-need-to-know-this topics.

One note, some of the topics covered are very large (Remoting and Security are two examples), and if you are interested in those topics, there are other books that deal with them individually.

Summary: if you are into creating top-quality .NET software you should own this book.

Open Sources: Voices from the Open Source Revolution

Open Sources

Voices from the Open Source Revolution

Edited by Chris DiBona, Sam Ockman, Mark Stone

280 pages

http://www.oreilly.com/catalog/opensources/

Review by Jim McKeeth

Like The Cathedral & the Bazaar and Free as in Freedom, this is one of the definitive books for the Open Source revolution that is made up of essays by industry and cultural luminaries. Much likeopen source software this book also comes with greater freedom for the consumer. From the copyright page of Open Sources:

Verbatim copying and duplication is permitted in any medium provided this notice is preserved.

So feel free to read or reference the complete online text of the book. Although if you are much like me you will see the great value in actually holding the book physically in your hand as you read it cover to cover. I actually started reading the electronic version of this book first, but when I fell in love with it I ran out to get the print version so I could read it while I was away from my keyboard. As much as I love free eTexts and online magazines I many times still prefer having the physical book or magazine in my hand when I am reading it.

Many people try to evaluate the Open Source movement on a technical level. They compare the features of Linux vs. Windows XP, MS SQL Server vs. MySQL, or Apache vs. Microsoft Internet Information Server (ever notice how uncreative Microsoft's product names are?) This movement is more then a sum of the products created, irregardless of how great these products may be.

This is also more then just a movement. It is greater then all the individuals involved. It is truly a revolution. The true benefits will not be known until much further in the future. One day we will realize that the revolution is over and the world is a place changed for the better. At that time we can start to asses the true impact of this revolution.

So what does this book have to do with all that? This book is a collection of essays from the "founding fathers" of open source. Looking through the table of contents is like a who's who in Open Source, including representatives from many of the larger open source projects.

This book is more then a history lesson of open source. It offers the reader the opportunity to actually get into the heads of the individuals who are on the front lines of this revolution. As you read each of their stories you see how their contributions are a representation of themselves, the greatest gift they can give. No wonder they want their work licensed in a way to be available to as many people as possible.

To contribute to an open source project is to selflessly give of oneself. A gift of this magnitude is not something you ever want someone else to own, control or restrict. It is a gift to be shared, just like this book.

I enjoyed every chapter except "Diligence, Patience, and Humility" by Larry Wall. That chapter was interesting at first, but then I just felt like it repeated the same point over and over again. Maybe that was Larry's point: there is more then one way to do (or say) things. I am sure that other people will find this chapter to be their favorite.

If you are curious to know more about why someone would contribute to open source, or are excited about open source and just want to learn more, then this is the book for you. I am sure it is required reading at some levels at Microsoft, if not then it should be. Know your enemy.

CodeSmith

CodeSmith is a FREEWARE template-based code generator that can generate code for any ASCII-based language. CodeSmith templates use a syntax nearly identical to ASP.NET syntax so that creating templates should feel immediately familiar to ASP.NET developers.

It sounds like a useful tool, and you gotta love the name.

November 2004 Meeting Wrap-up

We had a great turn out last night and a great presentation from IBM/Rational. Thanks to Clark, Ingrid and Pete for their time. From those of you who didn't make it we got an overview of the Rational Unified Process (which is really cool) and got a preview of the Atlantic release of Rational's suite that is due out later this month. Some really cool stuff.

Since we didn't have time to get to our reading we will cover chapters 5 - 8 next month.

Also on tap next month we have Chris with a presentation on SharpDevelop, the open source C# IDE. He will give us an overview and then provide some contrasts with other C# tools.

Time permitting I have a few other product demos to share. Should be a great meeting. We will see you all there.

Since we didn't get time to cover news I thought I would give you a few links to check into. If you have other news to share with the group then please email me, the group or make a list for next month.

Delphi 2005 Released
You can pre-order. It has been released to manufacturing. This version is an update to both .NET and Win32 development, and includes full C# support, as well as limited support for other .NET languages. This is the biggest improvement since the release of Delphi 1.

S5: A Simple Standards-Based Slide Show System
Uses XHTML, CSS and JavaScript to replace PowerPoint. Works in Opera, Mozilla, Firefox, Netscape and Internet Explorer. Designed to be easy to setup and even easier to view, all while being completely standards compliant.

ASM to IL compiler
Now you can write ASP.NET (or other .NET applications) in i386 ASM! Now you can put those assembly language skills to use on the new .NET platform.

Google Desktop released (beta)
Allows you to search your computer using Google. Only supports Internet Explorer for some odd reason.

Borland Conference 2004 Blogs
Erwien Saputra compiled an impressive list of blog entries that were created during BorCon, about BorCon proceedings. It's not as good as being there, but it's still pretty good! Includes posts and photos by yours truly.

30th Anniversary of Pascal symposium (Oct 22nd)
Hard to believe it has been that long!

The FAQs on FAQs
Tools and techniques for building and maintaining FAQs

Delphi Informant Complete Works CD-ROM
All 10 years, plus some unpublished works.

Delphi Algorythems and Data Structures to be re-released
One of the better Delphi books is being re-released by the author via print on demand.

C# is going to get Edit and Continue -- just like VB 6.
In all honesty this is pretty cool. Can't wait for Delphi to have it in 2006.

Check your HTTP traffic with Fiddler
Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler is designed to be much simpler than using NetMon or Achilles, and includes a simple but powerful JScript.NET event-based scripting subsystem.
(Thanks Rich!)

Tuesday, November 02, 2004

November 4th - Design Patterns Explained

In our Design Patterns Explained book we are reading we will be covering chapters 5 - 8 at the November 4th meeting. See everyone at 7 PM.

5 An Introduction to Design Patterns

  • The concept of design patterns, their origins in architecture, and how they apply in the discipline of software design.
  • The motivations for studying design patterns.

6 The Facade Pattern

  • What it is, where it is used, and how it is implemented.
  • How the Facade pattern relates to the CAD/CAM problem.

7 The Adapter Pattern

  • What it is, where it is used, and how it is implemented.
  • Comparison between the Adapter pattern and the Facade pattern.
  • How the Adapter pattern relates to the CAD/CAM problem.

8 Expanding Our Horizons

  • Some important concepts in object-oriented programming: polymorphism, abstraction, classes, and encapsulation. It uses what has been learned in Chapters 5–7.

2004 Delphi Informant Complete Works CD-ROM

2004 Delphi Informant Complete Works CD-ROM
Featuring:
10 years of great Delphi Informant expert content.
Every article appearing in Delphi Informant from 1995 through 2004!
All source code and sample files that you can use in your applications immediately.
Easily searchable CD-ROM makes it easy to find what you need.
FREE shipping!*
Bonus articles never published.

* Free shipping to US and Canada only. All other countries add US$10 for shipping and handling. Applicable sales tax applies to California residents.

Your subscription may be tax deductible if used for business purposes. Please check with your tax advisor.

Delphi is a trademark of Borland Software Corporation in the United States and/or other countries. Informant is a registered trademark of Informant Communications Group, Inc.

2004 Delphi Informant Complete Works CD-ROM

Now Only US$49.99!*

Pre-Order Now!
Informant Communications Group, Inc. 5105 Florin Perkins Road Sacramento, CA 95826