Archive for the ‘Thoughts’ Category

Code Snippet and Include Repository

December 16th, 2009 kaheidt No comments

If you’re any sort of programmer what so ever, regardless of what language you code in, then you have most likely at one time or another run into efficiency antagonist known as “reinventing the wheel”.  I’m talking about that string reformatting function that you’ve just written for the third time which is a little different (and hopefully a little better) than the first two versions because you forgot the first two even existed.  If you DO remember that you already invented the wheel, then you spend a good amount of time trying to figure out where you put that damned wheel.  And if you work in a team environment, any situation where one programmer creates a subroutine and then another programmer many months later remembers the email from the first programmer and then reuses that code, well that’s what we call “a friggin miracle”.

In an effort to fight this never-ending war, I suggested to my manager at work that we implement a centralized documentation system that everyone can update with their own pieces of code.  Then if you need to create a function to perform some task, you can search through the system to see if anyone has done something similar.  For my work place, this system ended up being an open source WIKI.  It’s not bad, and it’s certaintly better than nothing, but it still leaves the problem of having to search by a keyword and then sift through the results until it looks like there’s something useful, if anything.  This is especially true if you’re trying to search by one of the key words in your programming language.  You’d probably end up with every single entry as a result.

After thinking about possible ideas to make searching for code a little easier, I came up with one that I think could be really useful.  Basically my idea is to come up with a search method that is specifically designed for searching for code.  My initial thought is to allow a person the ability to search using specific input and/or output and overall characteristics and examples, and then have the search results be listed in priority using the percentage likeliness of a match.

For example, let’s suppose I wrote a function that is designed to take a dollar amount and then round it to the nearest multiple of 50.  My entry of this function into my documentation system would have the following characteristics:

Name: Round Amount To Nearest Multiple Of 50
Keywords: Rounding, Amount, Multiples of 50, Number
Input Type: String
Input Length: 20
Input Example: "342.99"
Output Type: String
Output Length: 20
Output Example: "350.00"
Variable Types Used: String, Integer
Search Process: [See Below]
Function: [The actual function code]

Then if I wanted to search for a function that did what the above does, I could search with the following criteria:

Keywords: Amounts, Rounding
Input Type: Integer
Input Length:
Input Example: 320
Output Type: Integer
Output Length:
Output Example: 300
Variable Types used: Integer

When the search with the above criteria is executed, the search program would not only check for similarities of what I actually put for each item versus what’s entered for each function, but it would also perform whatever data manipulation is entered in the “Search Process” part of the function entry on the example input data of the criteria in order to see how closely the results match the example output.  In order to do that, there’d have to be some translation depending on what language the document system is built in versus what language the code is that the repository is for, but believe me, it would be really REALLY nice to be able to provide my data and what I’d like my data to look like, and have the necessary code snippet come up to be copied and pasted.

Maybe there’s already something like this, or even more advanced than this, I have no idea.  But if it doesn’t already exist, well damn it, it very well should.  Google… read this and then do that thing you do to make dreams come true.  Thanks.

Categories: Thoughts Tags:

The PReS Challenge

October 20th, 2009 kaheidt No comments

What is PReS?
PReS is a software package that I use every single day at my current position which contains several utilities that ultimately are intended to take external data and use it to create printable document files.  Included in this package is a script compiler which will turn a bunch of script commands into a compiled file, which is what actually creates the document files.  The rest of the utilities are just extras.  These scripts which contain a whole bunch of PReS-specific commands are what I spend a lot of my time creating and updating each day.
PReS Screenshot

PReS Screenshot

To get into any more detail than that would be cruel and unusual punishment for you, the reader.  The only other detail about PReS that you need to know is that it was built with the idea that it would be used a specific way, and therefore has functionality limitations as far as programming languages go.  There’s also some undocumented behind-the-scenes problems with the software that can produce unpredictable results which a programmer, such as myself, must keep in mind when designing a script that very well may have modifications in the future.

This leads me to my topic of discussion: The PReS Challenge

The challenge that I am speaking of is the natural ever-present task as a a member of the IT industry to create systems that are more efficient,  more robust, and age more gracefully than my previous systems using tools that never change.  The version of PReS that we use at work was created in 2001, and there has been no updates to it since that time.  Oh, there’s been updates released by PrintSoft, but we just haven’t invested in them for reasons that I won’t go into.  The bottom line is that while technology in general becomes more advanced over time, the demands of our clients become more complex, but the tools that I have at my disposal remain the same.  The only option that I have in order to meet the demands of my clients is to adapt my thinking of how to use these tools to be more out-of-the-box by forcing PReS to function in a way that it was never intended to be used.  It reminds me of the movie “Flight of the Phoenix”, with Dennis Quaid, where his plane crashes in the middle of the desert, and the only way they can survive is by building a new plane using parts from the wreckage.  You see now why I said that you don’t need to know anything else about PReS is because the situation that PReS presents to me is not specific just to PReS programming.  It can be applied to any number of situations in life where the number of options are finite, none of which solve a problem, so you have to turn to creative problem solving by using bits and pieces from each options to achieve the intended goal.

There’s a comment that I’ve heard a lot of people say about technology that goes “As technology gets smarter, people get dumber”.  That may be true in some cases, like auto spellchecking or complex calculators, but in other cases just the opposite is true.  Technology is a very broad term, and the advancement of technology applies the idea that technological tools are either enhanced or replaced.  But in the situation of my work with PReS at my day job, my technology is neither advanced nor replaced.  So as more common technologies do evolve while my tools remain as they are, I end up becoming smarter because I am forced to think more creatively.

Categories: Thoughts Tags: , ,
Contact Form Powered By :