Ray Konopka is a long-time Delphi developer and author of numerous books and articles about Delphi. He’s also the author of the phenomenal CodeSite. I’ve known Ray for many years and am honored to call him my friend.
Twitter: @RayKonopka
What is your favorite programming language and why?
Like most developers today, I am proficient in several programming languages, but Delphi is, by far, my favorite. Delphi, often referred to as Object Pascal, supports the sophisticated features of modern languages but presents them in a way that fits in with the elegance of the language. Delphi is extremely expressive in its capabilities but maintains its readability.
Personally, I find it fascinating that some newer languages are starting to adopt some very Pascal like features. For example, Swiftplaces the return type after the name of a variable or method name. I have never liked the C convention of placing directives and types before the identifier–it just makes it harder to locate the identifiers.
The readability of Delphi should not be taken lightly, nor should it be considered a detriment to the language. Some will complain of having to type begin and end all the time, and why is it necessary to type then at the end of a conditional test in an if-block? I respond that using these little reserved words and others like and, or, and not instead of &, |, and ! greatly enhance the readability of the language. Oh wait, maybe that should be && and ||. My point is that code written in a language that is easier to read, is easier to maintain.
What one piece of advice would you give to a rookie developer?
I would highly recommend finding a mentor. One does not really go out and search for a mentor. It is not an official title someone has. But there are many seasoned developers who are more than happy to share their experiences and knowledge with you. I was fortunate to have a few different mentors early in my career, and now I have served as a mentor to others.
What is the most difficult programming challenge you’ve ever encountered?
This is an interesting question. Like any experienced developer, I’ve encountered many difficult challenges over the years. What is interesting are the reasons why a particular project is challenging. Some projects involve complex problems that require sophisticated programming solutions. Others may not be as complex but have such an aggressive timeline that they are equally challenging. One of my most difficult challenges was both.
I had just started my consulting company and Delphi 1 had just been released. I was working at a large bank in downtown Chicago training a team of Smalltalk developers on Delphi. The team had already been working with another consultant for some time and I was brought in to provide some extra training because of my Blazing Pascal column in PC Techniques magazine.
Everything was going fine until I received a phone call from the VP of the department on a Friday afternoon. He explained to me that the other consultant informed the team that the only way to leverage the object-oriented approach they wanted was to create their own custom components and not use any of the data-aware controls included in Delphi. The VP then told me that this was unacceptable, and they had terminated the contract with the other consultant. He followed that by saying that I needed to come up with a solution that would allow the team to create their business objects and still be able to utilize data-aware controls for their user interfaces.
When we finished, I hung up the phone and sat there stunned. On the one hand, I was excited that I was going to be able to bill more hours. On the other hand, I was freaking out. I had just started my consulting company. I hadn’t even been able to submit an invoice for the training I had performed. Now I had to come up with a solution to a very complex problem very quickly, or my consulting career may quickly come to an end.
That night, I started scouring the VCL source code. I was already quite familiar with the VCL source from creating custom components, but I needed to dig deep into the inner workings of how Delphi interacts with databases if I had any chance of coming up with a solution. I quickly discovered that the TField class plays an important role in Delphi’s data access model. Delphi datasets create TField instances to actually access at the underlying data. How that was going to help me, I didn’t know.
I don’t remember how much sleep I got that weekend, but it wasn’t much. After a lot of investigating, it dawned on me, “why do field objects have to be created by the dataset itself?” Sure, that is the normal approach, but in looking at the code, it certainly wasn’t a requirement. What if another component initiated the creation of the field objects? And what if that component knew about the business rules that applied to the data those field objects represented?
I created a new project to test my hypothesis, and…it worked! After that, I was on a roll. A few more tests, and the Data-Aware Business Components framework was beginning to take shape. By Sunday evening, the framework was solid. I even had a fully functional sample component complete with business rules.
I was so excited; I could barely sleep. I got to the bank early Monday morning and when the VP arrived, I told him that he needed to setup a meeting with the entire team—I have something to show. I felt just like Val Kilmer in Real Genius when his character goes to Professor Hathaway’s house to tell him he solved his energy problem. With the entire department crammed into the meeting room, I presented my solution. When I connected my business component to the dataset and all of the field objects got created automatically and the data-aware controls on the form were populated, jaws dropped.
I slept very well that night. Needless to say, I consulted with the bank for a couple years after that.
What is your favorite open source project and why?
I would have to say that WordPress is my current favorite open source project. Last summer I needed to redesign the Raize Software website, and after much research, I decided to use WordPress. Popularity was certainly a driving factor, but it was the wealth of knowledge that existed in the WordPress community that really sold me. In addition, the plugin architecture of WordPress is impressive. Although the sheer volume of plugins available is a bit overwhelming. But with help from the community I was able to select a few critical plugins for the site. Eventually, I was even able to create a custom plugin.
What would you say to the developer that was you five years ago?
My initial thoughts on this question were focused on regrets. For example, telling myself to start learning about cloud technologies sooner. But the more I thought about my experiences over the past five years, I would probably use the opportunity to reassure myself that everything was going to work out just fine. I would explain to myself that my development career was going to change dramatically in 2015 and that change would be extremely stressful. However, eventually it would all work out.
What one book should every developer read and why?
User Interface Design for Programmers by Joel Spolsky. I cannot recommend this book enough. An easy read that is packed with tips and guidelines about user interface design. This book does not talk about control placement, font colors, and other implementation details. Instead, Joel shares stories and anecdotes to discuss common user interface design challenges that developers face.
What is the worst advice that you commonly hear given to developers?
The worst advice that I hear is that source code formatting doesn’t matter. To be precise, I usually do not hear developers say this directly, but I do see it conveyed indirectly all the time. Unfortunately, many developers are lazy when it comes to formatting their source code. When questioned, they will justify their laziness by claiming that the compiler doesn’t care. Sure, most compilers are extremely forgiving when it comes to formatting, but code needs to be understood by people and not just compilers.
Imagine if I wrote this paragraph and did not capitalize the first letter of each sentence? What if I decided to only put three words on a line? What about using a variable number of spaces between words and sentences. The formatting would be inconsistent with the rest of the document and might actually cause readers to pause and think about why this paragraph was formatted differently. Was it done intentionally, or was the author simply lazy?
Even if you are the only one who will be looking at your code, source code formatting is a key facet to creating maintainable code. Just take a look at some code you wrote 6 months ago; let alone code you wrote 2-3 years ago. That code might as well have been written by someone else. That is why I always write my code with the intention that someone else will be reading it—even if that someone else is me.
Describe your favorite or most memorable “aha!” moment that you’ve had as a developer.
Well, it’s hard to top the data-aware business components solutions I described earlier, but a more recent example involved a new framework that I created for developing mobile applications in Delphi. I was in Germany attending the EKON developer conference. I was scheduled to present a session on Mobile View Management. I submitted the session based on the initial framework that I had created earlier in the year.
I was preparing my slides and code samples in my hotel room when I started to consider what questions I might get from the audience. I quickly noticed that there was a lot of project specific code intermixed with the framework. The framework worked really well for the one project I was using it for, but as I was creating a new sample project for the session, I realized that I was having to copy a lot of the same code. Not a very good design at all.
The framework made use of a variety of classes, interfaces, and types including enumerations. For example, each “view” in the app is identified by an enumerated value. The enum is used to safely drive all of the view navigation and management. However, the views, of course, are very specific to the current application. The challenge was to come up with a way to allow the base classes, interfaces, and types to be shared across projects, but allow for project specific enums.
I attacked the problem using generics. I’ve been leveraging generics for a long time; I even have a presentation on how to use the effectively, and I quickly isolated the view enumerations from the common code. Unfortunately, the common code still contained project specific functionality.
I sat in my hotel room trying to figure out how I could possibly isolate the project specific functionality. The challenge was that the framework leveraged an interface to represent the host (e.g. main view), another interface to represent a view, and a class that implemented the view interface. All the types were now generic to handle propagating the view enumerated type.
My “aha!” moment came when I realized that I could add another layer of generic typing and another layer onto that to isolate the project specific items. I had no idea if the compiler would be able to figure out the various levels, but there was only way to find out. I coded up the changes I envisioned, and after I got all the syntax errors ironed out, I was ready to run the program. It worked like a charm. I quickly went back and modified the slides to my presentation.
What is one weird or unusual thing you always do when you code?
I make extensive use of the numeric keypad for cursor navigation and editing. In fact, I despise the inverted T cursor keys and separated Home, End, PgUp, etc. keys. I have even created custom keyboard mappings so that I can do the same on my MacBook Pro. I also prefer to use the old clipboard commands of Ctrl+Ins for Copy, Shift+Del for Cut, and Shift+Ins for Paste. My right hand is already on the numeric keypad and Ins and Del are easily accessible. And hitting the Ctrl or Shift keys with my left hand is simple. I switched to using the Ctrl+X, Ctrl+C, and Ctrl+V shortcuts when they were first introduced, but contorting my left hand to hit those keys began to take a toll on my hand, so I switched back to the old shortcuts and have been fine ever since. And yes, I have custom keyboard mappings for the clipboard commands on my Mac as well.
What have you done as a developer of which you are most proud?
I have been fortunate to work on many notable projects during my career. I am extremely proud of the work that I have done for The Walt Disney Company including FastPass (used at every Disney resort worldwide), the Shanghai Disneyland interactive kiosk, and the animated attraction video displays in the new Toy Story Land at Walt Disney World.
However, I am most proud of CodeSite. Don’t get me wrong, I am also very proud of Raize Components, which Embarcadero acquired in 2015 and rebranded as the Konopka Signature VCL Controls. The difference is impact on the developer community. CodeSite has had a more profound impact—it has changed the way developers approach debugging. It absolutely makes my day to receive emails from CodeSite users telling me that CodeSite helped them quickly track down a difficult bug they had been chasing for a couple weeks.
Bonus Question: What is the answer to the one question that I should have asked you?
I’m going to pass on this one. For all the questions I keep coming up with, I don’t really like my answers. For example, “When are you going to write another book?” 🙂
A good read for all the seasoned and rookie developers out there. Agree 100% that a source code formatting must be considered by developer and it puts me off when I see a poorly formatted code from someone.
Great interview indeed.
Thanks, Samir! Tell your friends! 😉
I agree with samir