Amazon.com Widgets Nick Hodges | A man's got to know his limitations

I Have a New IDE Color Scheme……

By Nick at May 10, 2011 17:08
Filed Under: Delphi

I used a theme from the many found in the Delphi Theme Editor as a starting point, did a few tweaks, and ended up with my my new coloring scheme that I’ve called “ChocoCaramel”  What do you think?

image

What do you think?  Here’s the XML file from the Delphi Theme Editor if you want it.

ChocoCaramel.theme.xml (103.56 kb)

Getting Giddy with Dependency Injection and Delphi Spring #1

By Nick at May 09, 2011 23:13
Filed Under: Delphi, Software Development

I remember way back in the 90’s when I finally had “the light bulb” go on about object oriented programming.  You know “the light-bulb” I’m talking about  -- that moment when suddenly you get it and it all becomes clear and it all makes sense and you have this thrilling sense of understanding and one-ness with your code and the new concept.  It’s really fun.

For me and OOP it came in the middle of reading what is still my all-time favorite Pascal book, Borland PASCAL 7 Insider by Paul Cilwa.  I can still remember where I was sitting when suddenly it all came together in my brain.  It was very exciting.

And I was feeling that way again this week when I started doing Dependency Injection with the Delphi Spring Framework.  It really came to a head when I realized that I can create useful and powerful units that have no code in their interface sections. 

That’s right:  no code in the interface section. No uses clause, no code, no nothing.  Seriously – a unit that looks like this:

unit DoWhatever;

interface

implementation
  // a whole bunch of cool code here and nowhere else

end.

Yeah, you heard me – nothing.  And yeah, the cool code mentioned above works and is totally accessible.  That fact alone should give you pause – and give a clue into the power and coolness of what I’m talking about.  And yes, I’m still giddy about all this.

So, how does this happen you ask?  Well, it’s going to take a little while to explain – maybe even a few blog posts – so if you want to see this cool thing that’s got me all goose-pimply, you’ll have some to do some reading.

At the start, I want to say that I’m well aware that Java guys in particular have been doing this kind of thing for while, and that .net guys have been  as well.  That’s great. I know Delphi is a bit late to the party here, and I am too, but that doesn’t make it any less cool and it doesn’t make me any less giddy.  Winking smile

Okay, first, I’ll give you a few things to do.  To get the basic idea of where we’re going with all this,  I recommend that you read the seminal article by the inestimable Martin Fowler about Dependency Injection.  Understanding what Dependency Injection is  is key to all this cool stuff.  I’ll try to explain what Dependency Injection is in the first post, and then move on to the code itself.

Second, you’ll need at least Delphi 2010 and preferrably Delphi XE to do all this.  This stuff requires Parameterized Types (Generics) and you can only get that language feature from Delphi 2010 and above.

Third, you should go and download the Delphi Spring Framework from Google Code.   I recommend that you pull it using Subversion instead of grabbing the zip files as then you’ll be able to keep up more easily on this always improving project.  Get the code and start poking around, particularly in the Spring.DI.* units and the tests that go with it.  The TContainer class is really the heart of things, and so give that a close look.

And if you want some cool videos to watch that talk about a number general principles of how you can use dependency injection to make your code better, I’d recommend these three by Misko Hevery of Google:

And that ought to get you started thinking about some of the things you should be thinking about when doing Dependency Injection.

Next time I’ll give some samples of code and why this is all important.  And yes, I’ll likely be using a lot of the same material that Misko did.  Smile

My Old Blog is Back!

By Nick at May 04, 2011 09:39
Filed Under: Delphi, General

Hey, I’m delighted to note that my old Embarcadero blog is back online.  Thanks and kudos to David I who noticed that it was amiss and resurrected it.  He noted in a comment that the “archive” flag apparently didn’t mean what he thought it meant.  In any event, I’m very happy to have it back online.  Thanks, David I!

Flotsam and Jetsam #30

By Nick at May 03, 2011 14:00
Filed Under: Delphi, Flotsam and Jetsam

Flotsam and Jetsam #29

By Nick at April 26, 2011 08:43
Filed Under: Delphi, Flotsam and Jetsam
  • The folks at DevJet are at it again,  producing a cool little free enhancement to the Delphi IDE the makes your Help Insight window look cooler.  Help Insight is rendered according to an XSL file, and if you change that, you can make your Help Insight look as you please.  They also make it so that you can embed images in your /// comments that then appear  in the hint. 
  • Stay buggy, my friends
  • Cool Delphi Code of the Week: The Emballo Project. This is a nice dependency injection library that also has a really cool Mock object library as part of it.  I’ve actually updated the Mock objects to take Variants, and I’ll try to see about rolling that back into the repository.  The project hasn’t been updated since October 2010, but it is work a look and there is a lot to learn there.
  • In a previous Flotsam and Jetsam entry, I mentioned an interesting thread that was still alive after a long while that provides are reference to Delphi code that allows the integration of Crystal Reports.  Well, the author of the code must have seen my posting, because he sent me a message with a link to the file itself, offering it up for anyone who wants it.  Nice. He mentioned that it even works with Delphi XE.
  • Does anyone know anything about the Common Service Locator interface?  Is this a widely accepted way of providing service interfaces?  Has this been implemented in Delphi?

A Big Thank You

By Nick at April 15, 2011 13:59
Filed Under: Delphi, Software Development, Tech Stuff

I’d like to pass on a big thank you to Marco Cantu, Cary Jensen, and Cary’s lovely wife Loy Anderson for their wonderful hospitality while I was at Delphi Developer Days in Baltimore earlier this week.  It was an honor to be asked to be a guest speaker at the event, and I hope that my talk on unit testing with Delphi was worthy of the conference.  Cary also graciously gave me a signed copy of his excellent new book, Delphi in Depth: ClientDataSets

I should add that the conference was very valuable.  Cary and Marco do a great job and there were a lot of good examples and code, as well as a very nice manual with tons of great articles in it.  I heartily recommend attending next year if you are so inclined.

Delphi and Google Words

By Nick at March 31, 2011 20:43
Filed Under: Delphi, TechBiz

Hey, if you do a Google Search on “Borland Delphi”, you get a result that find kind of pleasing:

DelphiGoogle

Nice to see Embarcadero grabbing up a good collection of words and searches on Google and directing people to the right place. 

Flotsam and Jetsam #28

By Nick at March 31, 2011 11:36
Filed Under: Delphi, Flotsam and Jetsam
  • Delphi Book of the Week:  Cary Jensen has a new Delphi book out:  Delphi in Depth: ClientDatasets.  It’s really good.  I tech reviewed a few of the chapters (a lot fewer than I should have, but hey, I helped…) and can tell you that it is thorough, complete, easy to read, and certainly the best reference out there for the most important component for Delphi database developers.  I recommend that you buy it.
  • Lachlen Gemmell emailed me and let me know about his new Delphi site, TIndex.  According to Lachlen, it’s a “It's a Delphi specific web directory site. Right now the content covers language features introduced since Delphi 7 but I'll be expanding that over the coming months as well as transforming the site from the static layout it is now to a dynamic site that will accept link contributions from the community. “
  • The Hudson/Jenkins Drama continues, and gets more interesting!  What to do?
  • The indefatigable Uwe Schuster has an interesting list of QualityCentral feature requests that you might consider voting for.  (Remember, you up to have 10 votes per item, so don’t hesitate to use them).
  • I love the pure genius of this.
  • This is a very interesting thread on the Delphi forums.  A guy named Nils Dzubiel posted that he has a way to get Crystal Reports to work with Delphi 2009 (yes, the thread is that old.)  He posted his message in November of 2008.  Since then, there has been a steady stream of people posting a reply to his original message.  I can imagine people looking for ways to talk to Cristal reports with Delphi, finding the thread via Google, and then responding in hopes of Nils seeing it and responding.  It looks like Nils hasn’t been back to the newsgroups since early last year, so I’m curious if these pleas are answered. Anyone know what happens if you post a follow up to this two year old message? 
  • Wow.  Impressive. How does she do that? Is that all hers?  Is there something in there?  How did she get into the car to drive to the photographer’s?  The mind boggles.

Some Food for Thought About AppWave

By Nick at March 30, 2011 10:40
Filed Under: Delphi, TechBiz

Here are some facts, thoughts, and a conclusion concerning AppWave.

  • Embarcadero has announced their latest thing called AppWave
    • Marco has a pretty good article about it on his blog. 
    • It appears to be sort of a “AppStore for Windows”.  You can sign up for the AppWave store and publish your wares.  It looks like Embarcadero will provide the tools to virtualize your application, as well as to provide sales support.  You just write the app, post it, and watch the cash meter go up.
  • Amazon has an interesting announcement this morning,
    • They are creating a “CloudDrive” for storing your music out in the cloud.  You’ll be able to play your music from any computer, as well as from your Android phone.
    • You can get 5GB for free (I signed up already).  You can get more storage by buying songs and music from them, and the storing of Amazon-purchased MP3’s doesn’t count against you.
    • This follows closely on their announcement last week of their own Android marketplace.

amazon

Amazon started out as bookstore online, but they have expanded to selling almost anything that can actually be shipped  via UPS or Fedex, and more importantly – electronically.

And in the last few years they’ve moved beyond even that to being a leading player in the cloud space.  They have their own digital book platform in the Kindle. They are knocking on Netflix's door with their own Instant Video offering. Their EC2 platforms are pretty cool – you can basically own a computer out on the cloud for a very reasonable price – probably less than you would spend on purchasing and maintaining a physical box.  You can remote into the machine and manage it like it was your very own.  You can clone the machines with a click of a button.  Pretty powerful stuff.  And a pretty compelling, forward thinking business. 

I think it is safe to say that Amazon is not fooling around.

Apple and Google both should be looking over their shoulders.  Apple should be concerned about Amazon cutting into the iTunes arena, and Google should be feeling the pinch on the cloud computing side of things.  Amazon is coming strong into their space. 

Okay, so here is the conclusion I promised:  One of Embarcadero’s end-game plans for AppWave is to get bought by Amazon. 

Amazon is the only one of the players in this space not tied to their own OS, and thus can be the one that provides an AppStore for Windows.  (Google is OS neutral at best, but obviously interested in promoting Android and ChromeOS, and Apple, well, they are Apple, aren’t they.)  AppWave theoretically could be something that launches Embarcadero into the big-time, but it’s also something that the big-time players could very well want to buy.

And of course, one has to believe that Microsoft won’t be silent in all of this.

Thoughts?

The First Thing You Should Do

By Nick at March 28, 2011 21:47
Filed Under: Delphi, Software Development

We’ve all done it:  File|New|VCL Forms Application.  Then we drop a button and a memo, double click on the button, and write some code that prints out to the TMemo. You start out just “testing something out”, but then you end up working on a routine, or maybe even a class or a collection of classes.   Your “tests” are runs of the app, pushes of the button, and then looking at the output in the TMemo on your form.

TestApp

Sometimes you were just trying something out, but sometimes the result actually ended up being useful. 

At some point, though, you probably realized that this was a bit “amateurish” – not what “realy developers” do.   Pretty soon you discovered that all the cool kids did their horsing around in Console Applications, using WriteLn to output “SUCCESS” or “FAIL” or other data, depending on how things went for testing.  This worked out well – you could even set up a basic test harness to track the output by diverting the output somewhere it can be tracked.

Console applications are sexy and lean and mean.  You were cool.   You would eventually work what you were testing out up into a class and writing a bunch of sample code to make things work.   You probably ended up with a separate unit that had a class in it and a console application that called into that unit.  Way cooler that  your app with the button and the TMemo.

Okay, so that is all well and good.  But I’m going to argue that there is even a more sophisticated thing that we should be doing when we need to build something new – something that is designed specifically for proving that something works:  DUnit.  That’s what the really cool kids are doing. 

If you are creating something new, and there is even the slightest chance that it will end up being real and used in production, the first thing that you should be doing is not a simple form or a console application, but a DUnit based application.  This way, you can easily write tests to define how the thing you are writing should behave.  You  almost certainly end up writing a class (and you do put your functionality in classes right?).  You can then play around with that class, add tests, and see how things work.  You’ll get that beautiful green bar sliding across the DUnit Runner app, and you can continue to work up your class, add tests, and make changes with confidence as you work on stuff. Eventually you’ll end up with a tested class that you have confidence in.

It’s the ultimate way to “test something out”.  (Yes, I’m trying to sneak in the back door to get you to do Test Driven Development.)

DUnit ships with Delphi, and Delphi provides a nice wizard for creating a new DUnit application.  So there’s really nothing stopping you from doing DUnit first.

Flotsam and Jetsam #27

By Nick at March 01, 2011 23:07
Filed Under: Flotsam and Jetsam
  • Cary Jensen and Marco Cantu are getting ready to put on four of their Delphi Developer Days events.  I’ll be returning to my place of birth to speak at the one in the Baltimore.  I’ll be talking about Unit Testing with Delphi and DUnit.  I’m really looking forward to it, and if you are on the East Coast, I hope you can make it. Otherwise, I hope you can make it to another one of the three events. 
  • Blog of the Week:  If you guys aren’t reading The Delphi Hater’s Blog, then you are missing out.  This guy is a championship calibre ranter.  Great stuff.
  • Inspired by RADPlates, I’ve put my Live Templates Scripting Engine on BitBucket.  It is not real clean code right now – it allows you to insert the current date, time, and datetime into a script.  It includes example templates that replace “date” with the current date, for instance.  You can specify the Delphi formatting string for the date as well. (Same for ‘time’ and ‘datetime’).  I can see this being used for defining comments, TODO items, etc.  I think I’ll be turning my attention to this for a while now that THTMLWriter has reached a good stopping point.
  • As I’m sure you know, ChristChurch, New Zealand was recently hit with a devastating earthquake – much of the city has been destroyed.  There are a lot of developers in New Zealand – many of them Delphi developers – and they are banding together to help.  Dave Clegg is from New Zealand, and he’s posted about how you can do that – by buying a cool application! You can go to http://www.appappeal.co.nz/ and purchase an app, and 100% of the proceeds will go to Earthquake relief.  Many of you were so generous after the Haitian Earthquake (that was a lot of fun for a good cause) and so I hope we can be equally as generous to the folks in New Zealand.

Flotsam and Jetsam #26

By Nick at February 25, 2011 17:39
Filed Under: Delphi, Flotsam and Jetsam, Personal
  • Reader Paul Vandermyd kindly pointed out something that I had missed – that the individual downloads on GoogleCode download pages have download counts – and it seems 102 of you have kindly downloaded THTMLWriter 1,0 release.  But come on, people – don’t download it – pull it from the repository using Mercurial!  Anyway, now I have to figure out how to automate the uploading of the ZIP files with a 1.0 or 2.0 label on them, depending.
  • If you have Delphi XE then you have Version Insight – the feature that integrates Subversion (and potentially other SCM systems) right into the IDE.  I did a lot of work on that feature when I was at EMBT (well, actually, I did a lot of listening and suggesting; Dave Wilhelm did all the work….). The feature itself is derived from the MPL-based DelphiSVN project, and thus is itself an open source project.  As such , Uwe Schuster (who was actually involved in the pre-release development) has been updating the project, including starting in on support for git and Mercurial.  Sweet.  You can follow Uwe’s progress on his blog.
  • Sadly, if you go to my old Embarcadero blog you see this message: “This user has elected to delete their account and the content is no longer available.”  There was (if I do say so myself) a lot of good content there, and suffice it to say that despite the message, I didn’t choose to delete my blog.  Happily, much of the content lives on in the Google cache.  I’ll be trying to capture and republish as much of the good stuff as I can.
  • I’m beginning to wonder whether Simon Stuart is really a human being and not some sort of super-alien sent here from the planet Code-a-thon.  They guy is amazing -- “prolific” comes to mind.   If he’s not making Kinect work with Delphi he’s wrapping up the Twitter API in a Delphi component.   His latest project is one after my own heart – RADPlates.  I’m a strong believer that the Live Templates feature of the IDE is easily the most underappreciated and underutilized of the many features in RAD Studio.  Live Templates are really XML files, and RADPlates makes it easy to create Live Templates without the hassle of the XML stuff.  Highly recommended. 

THTMLWriter 1.0 Released

By Nick at February 21, 2011 14:33
Filed Under: Delphi
  • Okay – THMTLWriter is now an officially 1.0 product.  That means the following:
    • The default branch will now contain all updates to the 1.0 release – that is, bug fixes and doc updates.
    • The develop branch will the place where new development takes place – that is, any new features, developments, and updates.
    • I think that I’ve implemented the entire HTML 4.01 spec
    • Everything that can have a unit test does have a unit test.
    • I won’t change the interface until I release a 2.0 version.
    • I think there aren’t any more bugs or more things to do
    • The docs are not complete – I will continue to update the docs on the default branch.
  • Where is THTMLWriter 2.0 headed?  I’ll implement the HTML5 features as well as overload some additional methods with some of the commonly used default parameters.  That is, I’ll add more methods with the “typical” attributes as parameters so that you don’t have to do parameters yourself as much.
  • If you are actually using this thing, I’d love to hear from you. Google code doesn’t provide any way for me to tell if even one of you has pulled the code.  Winking smile

Flotsam and Jetsam #25

By Nick at February 19, 2011 15:25
Filed Under: Delphi, Flotsam and Jetsam

Flotsam and Jetsam #24

By Nick at February 11, 2011 16:36
Filed Under: Flotsam and Jetsam

My Book

A Pithy Quote for You

"Good judgement is the result of experience ... Experience is the result of bad judgement."    –  Fred Brooks

Amazon Gift Cards

General Disclaimer

The views I express here are entirely my own and not necessarily those of any other rational person or organization.  However, I strongly recommend that you agree with pretty much everything I say because, well, I'm right.  Most of the time. Except when I'm not, in which case, you shouldn't agree with me.

Month List