Home  Search  Products  Buy Now  Contact Us  About 2GS  Coder's Corner 
Home
Search
Products
Buy Now
Product User Guides
    myOwn10-Key
    myOwnPayday
    Trend Importer
    Double Text
Contact Us
About 2GS
Coder's Corner
    Double Text History


Email links not working?
Click here to find out why.

Links

eShopping-Directory


Free Downloads

Idaho at OyMap.net
A world directory

Double Text History
Repeat Text Writer ... What's That?
by George Gilbert, author of Double Text

While working on a project in 2001, I realized I was doing an awful lot of copying and pasting ... both code and repetitious comments. While trying to find some code in a previous project that was also relevant to the current application, I found myself saying, "Self, there has to be a better way." I was spending too much time looking for stuff, copying that stuff, then modifying that stuff to make it work in my new project. All that rummaging and fixing was slowing down my progress on the new project. It occurred to me that having re-usable code and comments readily available (as in one mouse click) whenever I needed it would be a lot easier, smarter and a whole lot more productive then what I was doing. Duh! Thus was born the kernel of an idea that has evolved into Double Text.

As is my usual approach to such epiphanies, I jumped on the Internet to try and find an existing tool that would do what I had in mind. I was disappointed to find nothing. There are, as you are well aware, programs that can be used to store and regurgitate code snippets. But, none that I found had the flexibility I had in mind. Ergo, I began to create my own solution. It has been a journey of discovery that has, thus far, taken four years and has lead to an entirely new approach to the age old issue of re-usable code.

Why Repeat Text Writer?

As part of refining this new approach to re-usable code, I've been trying to figure out how to refer to Double Text. It certainly didn't fit the mold for any software that I'm familiar with. During the development of version 3.0, I finally hit upon the term "repeat text writer." I don't call it a repeat code writer because Double Text can be used for any text that gets re-used. The application has proven to be even more versatile than I originally envisioned. For example, I use Double Text to store my logons and passwords. They are very easy to find and re-use whenever I can't remember how to log into a web site. I've even got a library that I use to generate an email to my Shaklee distributor for our monthly order of food supplements. It takes me just a few seconds to select the products I'm ordering and then enter the quantities for those selected products (most of which default to 1). Double Text then generates my entire email that I paste into Eudora. It's a simple process, but, I don't have to re-invent that particular wheel every month.

Of course, I have also accumulated a considerable collection of code libraries. Since Double Text has virtually no language restrictions, my collection is eclectic. In addition to repeatable code for VB 6 and VB .NET (my preferred languages), I also have useful routines in Java, JavaScript, C, HTML and Crystal Reports to name a few. A library I set up recently will be used to generate RSS feed files. I enter the titles, descriptions and links and Double Text generates the entire XML file. I've even got the full set of medical ICD-9 codes which, as you can imagine, is huge. However, finding a medical code is easy and quick using Double Text. Why in the world, you may ask, do I have the ICD-9 codes in a Double Text library? The answer is typical for a programmer, I think. I was curious if it would work. So I downloaded the ICD-9 files and wrote a simple VB 6 program to convert those files to Double Text source files. It was an interesting diversion.

I've begun making a distinction between code that can be re-used, and code that is stored and documented in Double Text. I call the latter repeatable code.

Re-usable vs Repeatable

I think a generally acceptable definition of re-usable code could be "code or functionality that will probably be useful in one or more future projects." It's a category of code that few managers or developers seem to pay much attention to ... until they need it. This is unfortunate since, in my opinion, re-usable code, when upgraded to repeatable code, has the potential to save big on development costs by truly putting the "R" in RAD (Rapid Application Development).

From what I can gather, there are currently five primary sources for re-usable code.

  • Components (objects) that expose their functionality through an interface
  • User controls
  • Repositories that use a database and accept a limited number of languages
  • Web sites where code snippets and sample projects are freely exchanged
  • Other projects you've worked on
Components and user controls are great if the re-usable code is appropriate for encapsulation. You don't have to be concerned with re-using code, only with re-using functionality. There is, however, a plethora of re-usable code that would be very nice to have handy, but, doesn't work in a component or user control.

Code repositories address this type of re-usable code. Unfortunately, code repositories tend to be limited. They can usually only be used with a few languages (normally one). In addition, repository programs typically use a database which makes the sharing of stored code less than easy. While these programs are typically very intelligent with the langauge they are designed to store, they are usually not known for their flexibility when preparing code for insertion into a new project. The ability to easily adapt re-usable code to new situations is essential, in my option, if code is to be truly re-usable.

Exchange sites, like The Code Project, make chunks of re-usable code, with instructions, readily available to anyone with access to the Internet. This free exchange of knowledge and specific coding solutions is ideal in concept. The usual implementation, however, has, in my opinion, room for improvement. You'll see what I'm referring to later.

Similar to exchange sites, the store of projects that a developer has worked on provide a gold mine of re-usable code. However, this type of re-usable code, like gold, must be found and then mined. And the search for, and mining of re-usable code in other projects is normally done only by the developer of the project because that person is usually the only one who has some idea of what nuggets are to be found. This "one person show" type of re-usable code makes this buried code of little use to anyone else.

Components and user controls serve well for their intended purpose. I think the main shortcomings in the re-usable code arena are with repositories, exchange sites and other projects. Repeatable code addresses the shortcomings of these code sources by taking the entire concept of re-usability to a new level. Here's how.

Repeatable Code Defined

Repeatable code extends the concept of re-usability by incorporating the advantages of speed, simplicity, predictability, portable documentation and ease of sharing. Double Text has evolved into a repeat text writer that embodies all of these advantages.

Speed Repeatable code is stored in libraries that are easy to navigate. You organize your libraries in any way that makes sense to you. Once a library has been opened, the duplication of any source code in that library can be started with one mouse click. Markers embedded in the source text enable customization of repeated code "on the fly" every time a source file is repeated. Ready-to-compile code is generated with as few keystrokes as possible.
Simplicity Markers in source files can be set up such that duplication and customization of source files requires little, if any, knowledge of the language in which the source text is written. Repeatable code thus becomes even more valuable by extending the re-usability of complex code to entry level developers.
Predictability The code in source files remains unchanged even though each duplication of the text in those files can be very different. It all depends on the embedded markers and how the user responds to the resulting prompts during each duplication. Regardless of how each repeated code is changed "on the fly," as long as the code in the source file is sound, each new duplication of the code can be counted on to be ready to compile.
Portable Documentation Overviews let you write any documentation you feel is needed for users of the source files. Users of the library can view this documentation as a reference whenever they are duplicating files by opening the Float Overview window. Each time a library is packaged and sent to someone else, the overview can travel with the code. In addition to the library overview, there can be a note pad for each source file, plus inline messages. Note pads can be used to keep file specific information that is accessible from the Double Text main window. Inline messages are embedded in source files and are displayed whenever encountered during each duplication.
Ease Of Sharing Entire source libraries, including the overview, source files and all note pad files, are easily packaged and sent to other Double Text users with the built in packaging and unwrapping functions. Entire libraries can be packaged into one file with a few mouse clicks. Recipients of library exchange files can unwrap packaged libraries just as quickly. The recipients of source libraries can immediately begin repeating ready to compile code from the new libraries they receive.

Now that you have an idea of what I mean by repeatable code, let's look at what typically happens when we take advantage of free code from exchange web sites.

Exchanging Code

The free exchange of knowledge and code is a long standing practice among developers. You know as well as I do that, especially with complex development environments like Microsoft's Visual Studio, getting some help from your friends can be a good thing, if not sometimes downright life saving. Contrary to popular opinion, Mountain Dew, Skittles and pizza can keep you going only so long.

While exchanging code is good, I'm sure you will agree that it can also be frustrating, time consuming and unproductive. For example, say you're working on a program and you start to write a procedure that involves doing something that you've never coded before. You don't have a clue how to write the needed code. So, you check any reference manuals you have lying around, ask your buddy in the next cubicle, etc, and, when no help from on hand sources is forthcoming, you turn to the Internet. Or, if you're like me, you start with the Internet. You either visit your favorite code site or click on your favorite search engine to do a broader search. And there it is; an article that includes the code you need. Hot bananas! Isn't it great to have friends in the business!?!

You quick like a bunny copy the needed code from your browser or download either source code or a sample project. Ok, now what? If your experiences using free code snippets are anything like mine, the sample code you copied or downloaded will not just plug into your project. First you have to dig your way through the code to try and get a glimmer of what the code does and how it does it. Then you have to make the exchange code compatible with your code. Cold bananas! This may not be as easy as it sounds. When I go looking for code on the Internet, I typically have to find several samples for the same function before I can find code that does everything I need it to do. It is not unusual for me to have to cobble something together by taking snippets from several exchange sites. It is also not unusual to end up with code that flat doesn't work in my project. What then? This is, after all, public domain and tech support can be thin.

Once you do manage to wrestle the free code sample into submission ("It's how late?!?"), and the gloating for a job well done is over, what happens later? What happens when you need this code again? Fast forward a few months or years. You're writing a project that also needs the procedure that you struggled so hard to make work in your last project. Or was it several projects ago? You know you have it somewhere. So, instead of searching the Internet for code samples, you start searching your own projects. ("Where is that code?!?") And, once you find it, you are again faced with ferreting out all the pieces you need and making them work in your new project. The only advantage you have this time is that, hopefully, you don't have to try and understand what the code author (you) wrote. I'm sure that's not a problem since you added lots of comments ... right?

Does all this sound familiar? How much time do you think is spent by coders like you and me world wide searching for sample code, and then trying to make that code work? (I think someone should do a study on how much this code search and rescue time has cost businesses. We could be talking gazillions!)

Conclusion

Double Text has had a profound effect on the way I think about, and do my coding. I honestly don't think I would enjoy developing software nearly as much as I do if I didn't have this tool for repeating code so easily. Code that I use often, or code that is complex to integrate into projects are made readily available and simple to use. When I finish writing code that I've never done before, I immediately think about storing it in a Double Text library; both for my own use and to share with other developers. These are subtle shifts in my thinking that have enriched my software development experience.

"I really have found from personal experience that your programs always hit the right spot. They are useful tools that do what they say they will do."
K. Millward
Great Britain

Home  |  Search  |  Products  |  Buy Now  |  Contact Us  |  About 2GS  |  Coder's Corner

Send comments on this site to Webmaster