Web Connection
Update on Web Connection 7.0
Gravatar is a globally recognized avatar based on your email address. Update on Web Connection 7.0
  Rick Strahl
  All
  Nov 11, 2018 @ 11:27pm

Hi all,

Here's an update where the next Web Connection release is at. I'm in the process of putting the final touches on Web Connection 7.0 with a final release hopefully next week.

You probably are noticing that I've changed the version from 6.50 to 7.0 to avoid confusion about whether this is a full upgrade vs. a point update. This release is a full major version upgrade. There are tons of new and improved features and support functions and it's been nearly 5 years since the last full 6.0 release.

For those of you that have already upgraded to 6.50 your upgrade of course moves to the 7.0 version.

What's left to do

The final version of Web Connection has been done for a couple of weeks and I've been running it in production here on the message board, my Fox blog, the Web Connection samples and a few internal apps. The core framework is ready to go, although I'm continuing to tweak a few things here and there.

The final push has been around a few key items:

  • Refactoring out VCX Classes
  • Cleaning up the base Web Connection Loaders and Samples
  • Adding Code Snippets for Visual Studio and Visual Studio Code
  • Updating the documentation

Refactoring out VCX Classes

Web Connection 7.0 converts a number of previously visual classes to PRG classes. The following visual classes were converted to PRGs in v7.0:

  • wwBusiness.vcx -> wwBusinessObject.prg
  • wwXML.vcx
  • wwSql.vcx
  • WebServer.vcx

VCX classes are a pain to manage in source control requiring extra tooling for conversion. They are also a pain to load in the Shareware version app file, and most of all they are a pain to access and edit using the FoxPro class code editor. I much prefer working in PRG files, and these days I often edit my FoxPro code in Visual Studio Code and that doesn't work on VCX files obviously.

So as one of the last steps in updating for v7.0 I've converted all these classes to PRG files. Now there's only one visual class left - wcVisual.vcx, which contains the actual visual components related to Web Connection (the web connection form, status form, the timer and few support dialogs etc.). Everything else in the framework is now a PRG class. Yay!

Changing to PRG Classes from VCX Classes

For most of these classes the upgrade process is simply a matter of converting the SET CLASSLIB TO to SET PROCEDURE TO directives. The class names and APIs stayed the same so other than that change there should be no incompatibilities.

I recommend two ways to do this:

  • Search and Replace in Files using a quality code editor like Visual Studio Code, Sublime etc. and change SET CLASSLIB TO <lib> references and change them to SET PROCEDURE TO <lib>
  • Use GoFish and manually find all SET CLASSLIB TO <lib> references and change them to SET PROCEDURE TO <lib>

This does end up causing some breaking changes, however I believe for most applications these changes are mainly search and replace changes.

In most cases you should be able to do a search and replace for SET CLASSLIB TO <class> to SET PROCEDURE TO <class>.

wwBusiness turns into wwBusinessObject

wwBusiness is an exception in this case - wwBusiness stays as a VCX, but a new wwBusinessObject class replaces it as a PRG class along with a wwBusinessCollectionList class for the child items list. The reasoning here is that some people will have visual subclasses of wwBusiness and there is no workaround for making that work with a PRG file other than converting all the subclasses into PRG files as well. For this reason, wwBusiness.vcx is still shipped (in the OldClasses folder) and retains the original class name.

To replace wwBusiness classes then is a two step process (if you use PRG classes already which you hopefully do as I do):

  • Use VS Code or other quality Editor to Search and Replace in Files
  • Replaces SET CLASSLIB TO wwBusiness with SET PROCEDURE TO wwBusinessObject
  • Replace wwBusiness with wwBusinessObject

For VCX based classes you'll need an extra step if you decide to convert and remove the old wwbusiness.vcx dependence:

  • Open up the Class Browser (FoxPro Tools->Class Browser)
  • Find any of your VCX wwBusiness Subclasses
  • Select the class in the tree
  • Use View Class Code
  • Copy the code from the Code Window
  • Create a PRG file with the class name
  • Paste the code into the new PRG file
  • Repeat and for other classes and either add to same file
    or use one class per file.

Finally if you were using the VCX wwBusiness class and you added the visual class to a FoxPro form visually, you should remove the wwBusiness subclass and instead in your form Init() do the following:

THISFORM.AddProperty("oCustomerBus",CREATEOBJECT("cCustomer"))

This effectively duplicates the behavior of a dropped visual class and replaces it with a property and the non-visual object.

Cleaning up Loaders and Samples

This seems to always one of the most time-consuming part of a new release - figuring out what to remove from the old version so that the new version only uses what is needed.

Admittedly I've not done the best job of this in previous releases because I still needed to have a number of legacy features included for the samples.

With this release I'm being much more strict in getting things cleaned up and explicitly removing old samples and rewriting other things like the Weblog to use MVC style applications from the old Web Control based interface.

And yes this stuff is what's been holding things up - it's time consuming to rewrite code in this way 😃

However, the end result is that new Web Connection projects are now much leaner when you first create them. The base EXE for a the User Security manager shrunk from 1.3megs to a little over 800k for the compiled EXE. That's a big improvement just for trimming.

Visual Studio and Visual Studio Code Snipepts

Intellisense is a wonderful thing and Visual Studio and Visual Studio Code (well most editors actually) support creating your own custom snippets that expand snippets into the editor.

To help make it easier to use common Web Connection and Web Connection related Bootstrap HTML constructs I've created a set of Visual Studio and Visual Studio Code snippets that help with inserting code.

The snippets start with wc- in both editors.

In Visual Studio you have to use:

Ctl-k ctl-x then navigate to the My Html Snippets -> Web Connection

Likewise in Visual Studio Code you can get the wc- snippets in HTML linked files.

There's information in the Web Connection documentation on how these formats work and it's easy to create your own snippets that you frequently use.

I highly recommend getting familiar with this as it's super easy to create snippets for any even mildly repetitive task. It's easy by just copying an existing snippet and adding your own text and renaming the snippet and shortcut.

In the process I also ended up creating a Visual Studio to Visual Studio Code snippet converter which means I can now create my snippets for Visual Studio and make them also available in Visual Studio Code which is great.

BTW, I've been using Visual Studio Code quite a bit with Web Connection project Web projects and it works well. You don't get the Web Connection addin but for pure HTML editing Visual Studio Code works very well without all of the bulk full Visual Studio. The full VIsual Studio - especially with a few addins like Resharper and the various Web Essentials addins is still a lot more powerful, but in a pinch Vs Code provides most of the core features.

I actually use both, often side by side. Both tools have their strengths and I switch back and forth frequently.

Documentation Updates

I've also spent a bunch of time on updating documentation especially around some of the classes that have changed like wwBusiness and wwXml. A lot of these old classes have had missing bits and pieces and haven't been updated to the new help format. A lot of that has been fixed.

I've also been able to optimize image sizes considerably with a new image tool I ran into recently:

Using this tool I was able to reduce image size by an average of 60% which has shrunk the help file down from 14megs to a little over 8megs, which reduced the size of the deployment package of Web Connection by that much.

Highly recommended tool. Not only does it better than optipng and pngout/pngGauntlet, which I've been using in the past, it's also drastically faster. What takes the other tools often minutes takes pingo seconds. Not sure how that's possible but I have seen no image degradation even in the most agressive modes at least for my screen shot images. The story might be different for true photo quality images.

Summary

So - lots of stuff still ongoing, but most of these tasks are in the end phase and I should be able to get it all finished in the next few days.

Look for the new release later this week.

Aloha,

+++ Rick ---

© 1996-2018