Widgets Flotsam and Jetsam #74

Flotsam and Jetsam #74

By Nick at January 13, 2013 12:56
Filed Under: Delphi, Flotsam and Jetsam
  • A while back I wrote a “How Not To Code” about not using Booleans as method parameters.  This line of real-world code that I ran across today -- myMonster.Run(cSourceStateLicenseWebNew, '1', '', False, False); -- is a perfect example of why this shouldn’t be done.  Who the heck knows what those last two parameters mean?
  • Does anyone know if that is real Chinese they speak in Firefly?
  • I don’t know if this is good or bad, but apparently I’ve visited StackOverflow on 1001 distinct days.  Yikes. (Maybe more by the time you read this….)
  • This is a really nice article on attributes by Francois Piette. I’m bummed because he used the example that I was going to use in my book.  Anyone got any better ideas?
  • Okay, I did a little more research on Arduino vs. Raspberry Pi, and I think I’m going to start with the Arduino. It seems more “science project-y” whereas the Raspberry Pi seems more like a complete computer solution.  Both sound great, but I’m more interested in the “controlling something” aspect rather than the “use all that small but powerful computing power”.  I think the Arduino would provide more stuff for me to do with my kids in terms of “making it all come alive”.  That’s kind of what I’m interested in, really – the “Mr. Science” kind of stuff.  Thanks to you all for the feedback.
  • I never talk much about Lazarus/FreePascal because I don’t use it and I’m not much interested in it, but it is starting to move more to the center of my radar as apparently you can use it to program a Raspberry Pi.  In fact, our friend Jeff Duntemann has set up a Raspberry Pi as a “regular” computer, and is using Lazarus to write code for it.  Not only that, he’s working on rewriting his classic “Borland Pascal from Square One” for Free Pascal, the current version of which you can download as a PDF.  He also reports that he’s doing a book on Lazarus.  It’s always good to see activity in the world of Pascal and Delphi Programming. Now if we could just get Delphi for Arduino, I’d be in heaven.  Winking smile   
  • I for one welcome our new drone overlords.

Comments (12) -

1/13/2013 1:35:12 PM #

Yes, it is actual Chinese curse words that they use in Firefly. They have someone on staff to do the translations.

Dr. Morrison from Pascal Programming For Schools reports using Oxygene for Java on the Raspberry Pi.

In theory you should be able to use Oxygene for .NET to program the Netduino, which is mostly hardware compatible with the Arduino - It is compatible with most of the same shields.

Jim McKeeth United States |

1/14/2013 12:19:50 AM #

Jim ---

Netduino looks very interesting -- thanks.

nick United States |

1/13/2013 1:46:54 PM #

I guess I should have said "They HAD someoen on staff . . . " since the show is no more.

BTW, the Netduino is a little more expensive then the Arduino, but it is a more powerful board (more RAM and processing power).

Jim McKeeth United States |

1/13/2013 8:05:36 PM #

and what does '1' and '' mean?

Dennis Germany |

1/14/2013 4:10:43 AM #

Hehe! Exactly.

François United States |

1/13/2013 8:59:18 PM #

lol Dennis. Smile

:) United States |

1/14/2013 12:45:17 AM #

At the science project level, if you've not been there, check Lots of good content, and leads to more.

William Meyer United States |

1/14/2013 4:48:31 AM #

Boolean parameters:
Let's have a hearty disagreement here. Your example is a perfect example of a bad example. When you have the full code, you also have the routine signature and (hopefully) the name and type of the parameters can make them obvious.

Presenting things like in your example, you should even be going after numerical parameters because it's impossible to know the type when you write -- myMonster.Routine(1, 2, 3); --. You can't even know if they are signed or unsigned, small or big, and more importantly, you have no idea of what they represent.
At least with Boolean types, the semantic is clear.

I would have more a problem with having too many parameters in your routine than the last 2 ones being Boolean.

And I stand by my comment in your original post, instead of creating a zillion of different enum types for every Boolean you want to use, create the appropriate public routines that can call a more general private one (provided you need it in the first place to centralize code and avoid duplication).

François United States |

1/14/2013 5:47:33 AM #

Arduino Delphi  or Pascal
Yeah, I would vote for that.  I would imagine that the code would have to be console as there is no visual output.  Also someone would have to finally figure out that we really do need a way to communicate with the serial(USB) port on the computer.

I do see that the FreePascal Community is working on something I wish I knew more about it to be able to help out.

Paul Vandermyde United States |

1/15/2013 6:13:09 AM #

I see two problems with this code:

- literals
- using booleans where you could have used more descriptive enumerations


Jeroen Pluimers Netherlands |

1/15/2013 8:00:56 AM #

Popping back, noticed the drone thing. I'm more interested in some of the fixed wing designs just for power efficiency reasons. There's some interesting work being done using wing portal fans to get VTOL capability into flying wings. That will hopefully give you a reasonably maneuverable, reasonable flight time/range vehicle that has better failure modes than the quadrotor things. Which, BTW, anything fails and they immediately fall out of the sky. Even pentarotor would be better, but the people lofting valuable paylos seem to use octarotor designs, presumably so even two rotor failures leave the device flyable, and allow them to run two independent powertrains.

Moz is scanning the skies Sweden |

1/16/2013 2:01:55 PM #

You could expand on Francios' example, and incorporate attributes to show how to create a lightweight OPF. One that infers database mappings based on  property names, but which can be overridden with custom attributes perhaps.

David Clegg New Zealand |

Comments are closed

My Book

A Pithy Quote for You

"Of all tyrannies a tyranny sincerely exercised for the good of its victims may be the most oppressive."    –  C. S. Lewis

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.