Flotsam and Jetsam #51

If you missed CodeRage 6, or you didn’t get to every session that you wanted to see (hear?), it is now all online.  That link also points to the latest offers and ways to find out more about XE2.  I love XE2, and think it’s the best Delphi ever.  And I say that not even using the FireMonkey/cross-platform stuff – so it’s even better than I think.  I was digging around in my boxes in the basement – we’ve moved a ton, and so I’ve got stuff scattered all over – and came across a CD labeled “Website”.  I opened it up, and lo and behold, there was a copy of one of my very first web sites, built with NetObjects Fusion.  It was fun to poke around and see some of my really old content.  (As a point of reference, the homepage has “This site was last updated on  Tuesday, December 18, 2001” at the bottom.  Remember when we used to do that?) Actually, I think some of the stuff will end up on my current site.    Not all the links work, but if you’ve been around a while, you might remember some of it.  Most of it was hand-maintained, but you can see where I tried to integrate in some early Delphi-based CGI stuff.   I actually still like the colors and the template.  The Generics.Default.pas unit is an interesting one – you may never have cause to use it directly, but it contains a lot of interesting stuff in support of the classes in Generics.Collections.pas.   It’s worth poking around in.  I was doing just that, and came across some interesting code – a function called (and I quote) BobJenkinsHash.  It is used rather extensively throughout the unit, and appears to be a general purpose hashing code.  Who is Bob Jenkins, you may ask?  Well, apparently he’s a guy that wrote a very powerful and useful hash function, and Embarcadero has utilized it as part of their generics library.  And here’s the interesting part – they created it using a set of GOTO(!!) statements whose use , well  -- I seriously can’t believe I’m actually saying this – actually kind of make sense.  The C code depends on the “fall through” nature of C’s switch statement, and the GOTO calls actually mimic that rather nicely.  I’m open to suggestions on how it might have been written better.  (Again – I can’t believe I just said that, but there it is.)  And to redeem myself, I’ll chastise the author for not defining his interfaces in their own unit.  (Sorry, Barry – I had to do something to restore my street cred for actually liking the way the GOTO’s worked…..) Anyway, interesting little find in the bowels of the Delphi RTL. I’ve added a new category, Three Sentence Movie Reviews.   I watch a lot of movies, and have all these aspirations of writing up movie reviews when I watch, but I never do because it takes too long.  So I thought I’d simply limit myself to three sentences in reviewing the film, and that way I might actually get the review done.  I might have to get a bit creative – sort of like keeping tweets to under 140 characters.  Should be fun.  If you read this blog via DelphiFeeds, you won’t see it as I’ll not be putting the Delphi category tag on them. Just another reason to subscribe to my real feed. 
Read More

One Right Thing at a Time

Wherein I discuss how to do things that you should be doing and how not to do things that you shouldn’t be doing….

Sometimes you tweet something and it makes sense to you, but then you realize that it also kind of begs for more discussion. 

For instance: “Things move so quickly that doing the *one* most important thing means it’s less likely that you’ll do the wrong things in the long run.” 

I thought that a little more explanation would be in order.  Let’s say you have ten cool features on your “Things Customers are Screaming For” list.  There are two basic approaches you can take to getting them done: You can do them in series or in parallel.  If you do them in parallel, you’ll get them all done sooner, but you may not get them done as thoroughly.  If you do them in series, it will take you longer to do them all, but you’ll likely get each one done more thoroughly.

However, doing them in series – that is, sequentially doing only the most important remaining item – has an added benefit:  It can help you not do things that you shouldn’t do.  You may have ten things on your “We need to get these done right away”, but as time passes, some of those things may prove to be not needed, overtaken by events, or just plain dumb ideas.  Doing things in parallel may mean that you get everything done sooner, but it also means that you might do something that proves to be a waste of time later on.

For example, if you have a team of five folks, and you have five ideas that take six man months each, you might give each person one idea to work on, and then six months later, you have all five ideas done. Great!  But uh oh! — as it turns out, over the course of those six months, things changed and events transpired in such a way that two of the ideas weren’t really good ideas after all, and at the end of the six months you regret ever starting on them.  So in the end, you have three things done that needed doing, but have wasted your time on two ideas that you should have left undone.  Furthermore, since you only had one person working on each idea, you may not get a fully fleshed out solution, but instead, one that may have missing features or is not complete in some way.

But consider what happens if you work on them in series: say that instead of starting in all at once on the entire list,  you pick the single most important of the ideas on the list.  You focus your whole team on doing that one idea.  You will likely be able to get it done somewhat sooner, say in one or two months instead of the six months in our example. (Five team members working on a six man-month project will likely take a bit longer because of transaction costs.)  In addition, you will get a “five-headed” solution instead of a “one-headed” one, and thus the solution would likely be more complete, fleshed out, and feature rich.  In other words, you might very well end up doing one thing properly and thoroughly instead of doing five things not so completely. 

The added benefit comes when, after doing the most important project, you realize that one of the ideas you had originally thought was awesome isn’t really that awesome, and that you can take it off the list and not waste time on it. You might add another item to the list, or another item that was on the list suddenly becomes vastly more important than it was at the start of the first project.  Instead, you can repeat the process and start working on the next most important thing.  You end up with a very nice implementation of each project you do undertake, and you don’t do the projects that shouldn’t be done.

In a rapidly changing technical environment, that which looks like a no brainer in January might be old news by July.  Obviously you want to avoid working on that project.  A practical example might be that you are a software tools vendor, and people are pressing you to do, say, a development tool for Windows Mobile 6.  You could choose to add staff and get that request done sooner, or you could stay the course and do more important things, only to discover with massive relief that you didn’t do Windows Mobile 6 at all when Windows Mobile 6 becomes a legacy technology.  (Sound familiar? ) 

Now, I’ll grant that if you follow this plan, you’ll end up with fewer features in the long run.   But you’ll also end up with more complete features with less wasted effort.  You won’t have spent time on things you ultimately should not have.  It might take a little longer to get any particular feature to market, but in the above example, you’ll end up with three really solid features and no time spent working on things that you should not have worked on at all instead of five half-baked features, two of which were a waste of time.

Repeat this process enough, and it becomes much more likely that you will end up with a product that has the right – and fully rendered — feature set.  In many ways, inefficiencies are the result of choosing to do the wrong thing.  If you keep your choices finely grained – that is, always put your efforts only into the things that are obviously the very most important thing to do do right now – you will end up doing the right thing every time, even if there is slightly less of it. 

It’s often been said that knowing what you should do is easy; it’s knowing what you shouldn’t do that’s hard.  If you repeatedly focus on and complete the one single thing you absolutely should do and do it well, it will be more readily clear what those things are you should not do. So, I guess ultimately, you have to choose: More features done less thoroughly with time spent on things that turn out to be a waste, or fewer, more complete features with fewer projects that you shouldn’t have done.

Read More

Read More

Advanced Transfers with Android

Thanks to everyone who attended this session at AnDevCon II in San Francisco and Dessert Code Camp in Phoenix. Here are the updated slides (a PDF) and code samples from this session. Please leave a comment if you have any questions and I’d be happy to?clarify?things, or point you in the right direction. You can also get the HTTP Telnet script I used in that session.
Read More

Google+ Delphi User Groups

A suggestion for self-curating the Delphi content on Google+! Why? Because although we all are lovable developers, we can only handle that many photos, reshares and caturday gifs!Using Google+ allows us to have a unified comment system, and a loosely coupled Delphi community where you can actually pick and chose among who you want to follow.Here is how:Step 1: Create your Google+ Delphi Page. With Google+ adding pages, we now can self-curate our content. This means that each of us can create our own Delphi page, which can be used to promote our blog posts, or our Delphi musings directly in the page stream. Note that we would need to refrain from posting caturday gifs, or reshares of the events of all world+dog on our Delphi page.Step 2: From your Delphi Page, Follow the Delphi User Group and/or Firemonkey User Group pages This will make your page visible to other Delphi users, assuming you also complete step 3.Step 3: Ensure that you show in public on your Delphi page profile that you follow the page(s) above. This because a Google+ page will NOT show you as a follower, unless you follow it in public. Step 4: Pick the pages and/or users you want to follow from the User Group pages. As people publicly add (i.e. follow with) their Delphi pages, the user groups will automatically grow the list of available pages and visible for all. Step 5: Enjoy a "spam free" Delphi circle!Step 6: Optionally, reshare your old personal Delphi posts on your Delphi page.The generic Delphi and Firemonkey user groups are just a start. Anybody can create their own topic-centric User Group page as well. If you want to help grow the Delphi community:Create your own Delphi page, and follow the User Groups!
Read More

SmartInspect for Delphi XE2

If you are a Delphi developer you likely already know that Embarcadero recently released this year’s Delphi update called Delphi XE2. Delphi XE2 comes with support for 64-bit systems and with multi-platform capabilities. We just released an updated version of our logging tool SmartInspect that supports Delphi XE2 for Windows and Windows 64-bit systems. Please note that we don’t currently have plans to support SmartInspect for Delphi for Mac OS X and other cross platform targets. As the SmartInspect logging library for Delphi makes heavy use of the Windows APIs for performance reasons, we first want to wait on how popular the Delphi cross platform capabilities will become. If Delphi for Mac OS X becomes more popular we will certainly consider supporting this environment as well. If you are a registered customer you can download the new version from our customer portal. You can also download the updated trial version to try SmartInspect for free. Just let us know in case you have any questions or feedback about the new version.
Read More

Delphi-Treff interview–In English

I recently did an email interview with Martin Strohal of the Delphi-Treff Team. I got permission to publish the original English version (Since my German is a little rusty…) Delphi XE2 will be published this year. What are the key features of this new release? (Is this the release named "Pulsar"?) Customers will now be able to target Windows 32bit, Windows 64bit, and Mac OSX 32bit. XE2 introduces a new cross-platform GUI-centric, GPU accelerated component framework called, FireMonkey. VCL also received an extensive upgrade with the introduction of Styles. New in XE2 is LiveBindings. This provides a powerful and flexible system that allows binding any kind of data source to any property or properties. The data source can be nearly anything, including other properties. There will be a new framework called FireMonkey. Can you tell us, how FireMonkey works and what’s is job? FireMonkey is designed from the ground up to be cross-platform. It, by design, isolates all platform specifics into an independent platform layer. While FireMonkey extensively uses components, how it actually renders to the GUI is significantly different from VCL. While VCL uses independent, self-contained components that all render using their own techniques or even wrap existing Windows controls, FireMonkey manages the display of content using compositing. This allows for significantly more flexibility in GUI-design. Animation is built into the framework in order to allow very interactive and advanced user interactions. Like animation, filters and transforms are also built in which allow the who UI of portions thereof to be manipulated. For instance, a small modal popup could be displayed and rather than merely disabling the main UI, you could apply a blurring effect to the UI behind the modal popup giving it more depth of field. This blurring effect is applied while compositing the UI and is independent of any rendering of the components/controls. Is FireMonkey a replacement for the VCL or an addition? VCL was first and foremost designed to be a relatively thin wrapper to make Windows programming simpler and more accessible. VCL effectively embraced many Windows programming concepts and made them intrinsic to the framework. This certainly made Windows programming a far more productive and pleasant experience. It also inextricably tied VCL to the Windows platform and all its unique characteristics. We had several goals with FireMonkey. First of all we wanted a framework that allowed for the creation of very rich, interactive, modern UIs. We also wanted a framework that wasn’t hog-tied to a given platform. FireMonkey is not intended as a replacement for VCL; rather it is intended as a whole new way for customers to embrace the emerging market for richer, more interactive desktop applications along with the burgeoning mobile space. If I want to run an existing Delphi application under Mac OS X. Do I have to convert it to FireMonkey first? Will there be a converter? VCL and FireMonkey share common RTL and database components such as dbXpress and DataSnap. While you will not be able to simply recompile your VCL based application for Mac OSX, you will be able to take all your code which exclusively uses the RTL and DB components. As for converters, I know that at the time of this writing there are several third-parties offering VCL->FireMonkey converter products. What are your future plans for FireMonkey? More platforms and mobile. FireMonkey is how we’re keeping relevant in the emerging heterogeneous mobile and desktop platform world currently emerging. Throughout most of the ’90s and early ’00s, the mobile computing space was non-existent or very niche. Apple and the Mac OS were actually in the decline and many weren’t sure they’d be around to see 2000. What a different world we’re in now. The desktop Mac OSX is making significant inroads into the enterprise, and the mobile space is anything by niche. Tying Delphi strictly to the Windows platforms ignores huge opportunities for both Embarcadero and all our Delphi customers, new and old. With FireMonkey, XE2 is positioned to be the only /native/ cross-platform framework that targets both major desktop operating systems and one of the dominant mobile operating systems, iOS. Expect to see FireMonkey become more powerful and even easier to use and target even more mobile platforms in future releases. The applications cross compiled for OS X are native. Is there the new Delphi compiler on duty? And will it be used for "normal" Win32 applications in future? There are three new compilers introduced with XE2. Delphi Windows 64bit, Delphi Mac OSX 32bit, and C++ Mac OSX 32bit. All of these compilers are derived from the existing codebase. They all essentially share the same respective "front-ends", the part of the compiler that translates the source-code into an intermediate form in preparation for generating machine code. The existing 32bit Delphi and 32bit C++ compilers are still very much in business. We have some research projects in progress for targeting even more platforms and CPU architectures. If new compiler: Is the new compiler fully downwards compatible? Or are there some functions abandoned? For XE2, the current compilers were employed in order to ensure maximum backward compatibility. Looking to the future, we’re currently researching new directions for both a compiler architecture which allows for quicker targeting of new architectures and looking at adding more advanced, and even more modern language features. This may mean eschewing some older features of the language. Are there some new Features in Delphi XE2 for people who will only develop VCL-Win32-Applications? As evidenced by XE2, VCL is still very much a key part of the product. With the addition of Styles, the programmer can take their existing VCL based applications and update and modernize the look and feel by using the new Style engine. The third-party component support remains one of, if not the best for all independent development tools on the market. VCL is still the fastest and easiest way to develop*Windows* applications. Also, with XE2 and now being able to target 64bit Windows, most VCL applications can now be merely recompiled for 64bit, subject to the normal 32bit->64bit caveats. Will there be a new Starter edition again? And do you have any plans for a free Delphi (for getting more new blood in the Delphi community)? Starter edition is very much a key part of our product line. When you compare the price point of the Starter edition taking account of inflation with the price of the original Turbo Pascal coupled with the vastly superior capabilities of Starter compare to Turbo Pascal, I think you get far more value than the price. We also have very competitive offerings for the educational markets, where one can get nearly 80-90% off of all the products. As for a free edition, we’re always looking at ways to grow the community base without the potential for harming our existing, very strong and growing market. At this point we feel that the Starter edition provides a good balance of price, capabilities and value. Starter is positioned directly at the new customer by including features that most new customers would need right away to in order to both learn the environment and begin to develop commercial applications. Share This | Email this page to a friend
Read More

Flotsam and Jetsam #46

  • I will be speaking this year at CodeRage 6.  I’m giving two talks, one on Dependency Injection, and one on Unit Testing.  Please attend.  I think my talks in particular will be really good.  But maybe not as good as all the other stuff you can learn there
  • Are you aware of the fact that FireMonkey, RAD Studio, and Delphi all have spanking new pages on Facebook?  I wasn’t.  And they do.
  • Holy crap!  Allen Bauer is alive!
  • I’ve been trying to write some more example applications for the Delphi Spring Framework, and so I was researching the Factory Pattern to see if I could find a good illustration to build an example for (TFoo and TBar can only take you so far….) and I ran across a nice article on MSDN that describes it nicely.  It actually has a nice example of a “Computer Factory”, and I’ll likely riff of that to create a “real world” example of a physical object.  But the part that caught my notice, and caused me to write this entry was a quote at the beginning:  “When was the last time someone asked the designers of the Empire State building to add ten new floors at the bottom, put a pool on the top, and have all of this done before Monday morning?” And the answer, of course, is “never”.    Anyway, it just was another data point in my ongoing contention that software developers are not engineers. 
  • This is a pretty amazing and thorough tutorial on LiveBindings.  Live Bindings is one of those cool features that I need to learn about and that appears to be cool now, with the potential to get a lot cooler in the future.

Read More

Read More

DSharp Bindings vs LiveBindings

I think it's finally time to compare these two things and see which one may fit you better. This is my point of view that may not be completely objective.When I noticed that there was actually no language support for LiveBindings I was very disappointed. I think without language support you cannot create anything that works much different from how DSharp Bindings work. And actually LiveBindings don't. I could not just change the VCL source code so I had so come up with some "hack" (using the interceptor pattern by including the VCLControls unit that subclasses the supported VCL controls). Of course the guys at Embarcadero had the power to change the VCL classes and that is why they implemented the observer pattern into TComponent I guess. Did you notice that is not that easy to connect simple TObject descendants with LiveBindings? Another thing is that you cannot just connect your Edit to some other component, set up the binding and it works. You still have to write code into your OnChange event because the observer only is activated when you use TBindLink. And this will usually set your edit to read only unless the SourceComponent implements some specific interface. I am very sure the whole BindLink part of the LiveBindings was only for enabling data sensitive controls for FireMonkey (something I have not looked much at yet).In my opinion for simple bindings like displaying some address or customer Data the point goes to DSharp. It "just works" instead of having to write extra code which should not be required because that's the purpose of bindings.So what about more complex data like displaying a list of objects in a grid? DSharp does not support any grids yet but it got support for listview, treeview and the virtual treeview. Supporting the stringgrid is on the list and will definitely come. How does it work? Well you just connect your list to the view property of the supported control and you specify a data template that needs to be written in delphi. In fact it turns out to be a bit more complex sometimes. When using the virtual treeview and the treeview presenter you want to specify the columns and then you can bind these columns to the properties of your objects in the list. Have you tried yet to bind a list to some listview or stringgrid using LiveBindings? I have and I failed. To be honest I gave up very quick because this was just so cumbersome and required several string based expressions. Did I mention that the documentation on the new features in XE2 especially LiveBindings sucks? Well yeah my documentation does as well, but I don't have a documentation team working for me, right?Again DSharp Bindings are focused on doing simple things very easily without locking you out when you want to do more complex things. LiveBindings are very unintuitive to use. I think this point also goes to DSharp.What about connecting your dataset to some controls? This is something I haven't done since ages (except when working with a grid) but this is where LiveBindings got their power - as I said earlier I think their major task is doing exactly this. Unfortunately the designtime support for this is only enabled in FireMonkey but in VCL you have the DB controls anyway. DSharp just does not support this. I have thought about implementing it but I don't see the point. If you want to use datasets just use db controls which have been working for ages. In FireMonkey you just connect your edit to a field with a few clicks.Point for LiveBindings.As you may know there is some expression engine sitting below the LiveBindings that can do some nice things like calculating, concatenate strings and much more. There are built-in functions that can be used (like UpperCase, Round or FormatDateTime). I am happy to tell you that DSharp got an integration with DWS just yesterday. So you can basically use everything that DWS can do in your bindings. From making your text capital letters to doing complex calculations or even evaluating business rules if you like. Since DWS is a real scripting engine you have way more power than the LiveBindings expression engine..I am very sure with this latest addition this point goes to DSharp.If you don't trust open source because it may not be continued in the future or does not give you the feeling of safety you may use LiveBindings. Also LiveBindings are ahead regarding designtime support - even if it is kind of cumbersome setting them up sometimes.For being the "official solution" LiveBindings deserve this point.So the final score is 3 to 2 for DSharp in my opinion. Again I have not been digging through tons of samples and documentation and since Embarcadero always just shows tons of fancy stuff in FireMonkey, other platforms and so on the documentation on this feature is not very present. I like simple solutions to simple problems. I totally hate full blown over-engineered solutions that are a pain to use in your daily business. And I have the feeling LiveBindings are over-engineered and not well designed. Otherwise they would be easy to use like throwing an edit and a button and the form and make them work, right?If you like using data bindings in any Delphi 2010 or newer you should definitely take a look at DSharp. Also there is much more in it than just data bindings.
Read More