July 2007 Archives

Why not MDI?

| | Comments (6)
This question comes up fairly frequently, so I figured I'd take a few moments to explain why you should never use MDI in a new application. To truly understand why not, you have to first understand "why" -- so I'm going to give you a brief history lesson. Rewind about 20 years or so to the pre-Win9x days. At this time, the OS wasn't preemptive-multitasking (it was cooperative), which meant that switching between processes could be a dangerous thing. If the process in the foreground was hung, the whole machine was hung. What's more, the process in the foreground was
Oftentimes, when working in REALbasic, you'll end up using the dot operator as a way to perform some action. If you have experience programming in other languages, this can oftentimes illicit some implications about the performance of the operation. In other languages, the dot operator (or arrow) will cause a method call or dereference to happen. When done in a tight loop, this can sometimes affect the performance of an application. For instance: for (int x = 0; x > 16) & 0xFF; } } for (int x = 0; x It is assumed that in C/C++, the second code
One neat new stability feature of Vista is the transactional file system functionality that the kernel exposes. This makes error checking almost trivial for file operations which are required to be completed as a set. The basic idea is that you start a transaction to obtain a handle, then do a bunch of operations using the transaction handle, and then commit (or rollback) the transaction using the handle. If something goes horribly wrong in the middle of the operations, you don't have to worry because the entire transaction is rolled back automatically (unless you commit it). So, let's say the
Are there ever times when you want a cryptographically secure block of memory? Sure there are! Let's say you have a Password EditField that the user puts their secure password into. You don't want that password sitting around in memory as plain text -- that's their password! Instead, you want to make sure that data is secured. Let's make a SecureMemoryBlock class that does this for us. The first thing we need to do is make a new class and set its super to MemoryBlock (and call it SecureMemoryBlock). The next thing we need is a way to secure the
I apologize for Serial.Open. It's a terrible API. Thankfully, I can at least say that it's not my fault as this API has been around in REALbasic for eons (well before my time). You see, the problem is one of expectations. When an API in REALbasic returns a boolean, the expectation on the user's part is that it's generally a property and not a method. This stems from the fact that in ancient times, the only way to achieve a read-only property was to use a method. So Serial.Open() as Boolean certainly seems like it is a property which tells
As per Kenny Kerr and Scott Hanselman, here's my take on three things I've learned about software both in and out of college. In College 1) It's not about getting the right answers. It's about getting the process right and jumping through hoops to do so, regardless of whether they make sense or not. 2) Java is the best thing since sliced bread. :: snorts :: 3) It's hard to learn when the person teaching you speaks broken English with a thich accent. Out of College 1) Good features mean more than just code -- accomplishing the feature is only
If you develop plugins for REALbasic and use the powerful but under-documented dynamic access APIs, then this is a hint for you. If you need to call a method on a superclass from within a plugin, you can use REALLoadObjectMethod to do it for you by prototyping "Super." into the method you want to load. For instance, let's say you're making an SSLSocket plugin, and you want to call the TCPSocket.Connect function from within the SSLSocket.Connect function. You'd do that like this: void (*tcpConnect)( REALobject ) = NULL; tcpConnect = (void (*)(REALobject))REALLoadObjectMethod( someSSLSocketObject, "Super.Connect()" ); Neat, eh?

Forums Pet Peeves

| | Comments (11)
1) Asking a question, but not giving all of the information that puts the question into context. This is a tough one, because you don't want to make your post too wordy (otherwise no one wants to read it), but at the same time, you need to give some information in order for people to truly help you. Quite frequently, I see questions like "Why does X happen this way?" and after a long discourse, I come to find out that they're writing a service application or something along those lines. Well, that kind of changes the answers you're going

Blogroll

Friends
REALbasic Related
Win32 Programming

Disclaimer

I'm currently an employee of REAL Software. My blog is mine. The opinions represented in this blog are mine as well and may not represent my employer's opinions. All original material is copyrighted and property of the author.

REALbasic® is a registered trademark of REAL Software, Inc. REAL SQL Server™ and Lingua™ are pending trademarks of REAL Software, Inc. All rights reserved.