Hand Code vs App Gen

Due to our stagnation in 6.3, even though we had more modern versions available like 8.1, 9.1, etc., but for various reasons, we never completed the migration, the need arose to implement intensive API calls handling with JSON.

We considered what to do: templates, third-party solutions, DLLs in other languages, etc. We looked into the libsrc of C10 and found the library we needed. Well, it was very simple to change 2 or 3 *queues in the return of the functions in one way or another, and it was done. When we finally upgraded to C10, everything worked correctly.

Of course, due to issues with that library (errors with JSONs larger than 64K), we started using Mike’s fantastic cJson. But that’s another story.

Sure. No template covers all the properties and methods (and never has). That’s true for ABC, and just about any 3rd party one. For some, it doesn’t even make sense to have a template. So in the sense that classes operate (mostly) without templates, there’s no argument here.

But even ā€œminimalā€ templates are really useful. The global StringTheory template for example takes care of the EXP file, and manages all the Internal / External conditional compiles etc. It makes using the class a lot easier than manually adding INCLUDE lines, setting conditional compiles, and so on.

I’m not sure why you’d ā€œreplaceā€ an ABC app. There’s nothing wrong with the underlying idea, and it’s been reliably built on for 27 years. It’s easy to add on to, it’s easy to extend and so on. I’m (personally) in no rush to replace it. It’s solid and well understood. replacing it now with new code would server very little purpose that I can see.

1 Like

Not actually replace, but rather new ABC alternative. It goes back to the comment from Mark regarding ABC.

From what I understand Mark is still using (parts of) ABC as his foundation. He’s expanded the feature set in his own classes to suit his needs. He’s been able to derive classes from it that are tailored to his preferred behaviours etc.

It’s not hard to extend ABC - I’ve been doing that for 27 years now. So I’m not really sure what a ā€œnew ABC alternativeā€ would need to do that we can’t do already today, or which ABC could not be extended to do. ABC is just a ā€œfoundationā€ - on top of that we can build most anything we want.

The foundation of my 100+ year house is stone. Over the years, it has supported many changes to the house above. If I were to build a new house on vacant land, I probably would not apply the same construction requirements/methods used by the Bayliss Foundation Company back in the day even if my visual desire was the same native stone.

I think Mark uses the Designer for some windows. Mark uses my Window Preview Class to adjust the live window controls at runtime. He then has the precise AT() and Justification settings to change his window code. There is also a LIST Re-Formatter to get exact column settings.

The IDE Window Designer is good but not 100% accurate. Things like SPIN() controls are way off if you are trying to fit controls tightly like below changing a SPIN to use HVScroll buttons needs Width to change from 28 to 38. Compare to the default stacked buttons used on the Year of ā€œAnother Dateā€ down below. This from Date Time Tool.

1 Like

Getting back to the OP’s original question …

A Hand Code project is often the best way to make a DLL that will contain a Function Library to be used by many APPs or other projects. These would be Functions or Classes that do not use any kind of templates.

Making this kind of DLL with the APP system will force you to include lots of template stuff you don’t need. Also you often require Export/Import things like Global Request / Response that make it hard to use in many different APP’s that use different DCT’s. Some of these Export/Import have been made flexible in the templates or can be removed with extension templates that rewrite the EXP. Not being an APP the DLL can be ā€œlean and meanā€.

Being a DLL the Main procedure will never get used. You can put some useful code in Main to let you do some testing when you change the Project to a EXE. This EXE Main is handy to run some DLL code under the Debugger or tests.

In some of your current work you’ll see this in the 20+ EIC DLL projects that are all Hand Code. They have almost no code and simply export 1 class. This was due to the problem that C8+ cannot deal with the same File in multiple Classes causing a link error. So each class is one DLL. To test using those DLLs there are some very small hand code Projects that import them. This keeps the code as small as possible and make it easy to run under the debugger.

2 Likes

Thank you everyone!

With just the small amount of time I have been experimenting with a ā€œhand code onlyā€ project, I can see how having total control of every part of the code could be advantageous. Clearly templates have their use cases. For example, I could see where a NetTalk web server would be prohibitively hard to do with hand coding.

I have really enjoyed reading everyone’s thoughts.

Are you referring to CapeSoft Object Writer or something else?

Something else.

Object Writer was an early template which assisted with writing classes by generating the boiler-plate syntax. It was a useful beginner tool, but once the syntax is familiar it’ s easier and faster to just edit inc and clw files by hand. (There are now class-writer templates in the box for those who wantvto go that route.)

The templates im referring to are cape01.tpw and cape02.tpw. These are common code that ship with all our classes (including the free ones.) They make creating a TPL for a class, or set of classes, trivial. They cover all aspects of using a class in an app or large app system.

Don,

I still have a template which I use for single proc clw/dlls that handles all those bits of hand coding things like the exp file that way I don’t have to remember it any more.

The templates provide a framework for future additions to an app and where there is a lot of prompt filling in the template, I do some prompts then export to txa and finish the rest off in the txa sometimes, but you’ll get a feel for when that’s faster than prompt filling.

So unless extensibility is never going to be needed I don’t really see the point in hand code now imo.

UI code is generally pretty simple
But even with APPs I found a lot of code that doesn’t need to be generated,
Instead it can be put into a base class.

A form is often just a window structure and a dozen lines or so of code

In the case of control templates, those can generally be written as WindowComponents
which just take a few lines to add a lot of functionality to your window.

As to screen layout, when starting out I might use a window formatter to get close
but as Carl pointed out earlier in this thread, the window formatter doesn’t exactly match runtime so I use Carls preview tool to tweak the controls (mainly AT attributes) at runtime and then copy the changes back to my code.

I can of course open the my window or report structure any time using the SV.IDE window formatter, but again that’s become pretty rare for me. It just isn’t quick and accurate enough.

When I’m moving a lot of controls, I place a cursor on each AT attribute, and press a keystroke for an addin (Inc-Dec-Value), that adds (or subtracts) 1 from the number under the cursor. If you’ve never worked with multiple cursors it’s hard to really understand just how simple and effective this is.

They say that a picture is worth 1000 words. Would you be so kind to include a small example.
thanks, marcelo