Focal Point
Coding Conventions and Standards

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9091002041

December 02, 2005, 11:46 AM
dlb
Coding Conventions and Standards
We're a fairly new WebFOCUS shop. We haven't even gone to production yet.
Are there any published coding standards or conventions that are available either publickly or for a price? I am working on establishing standards for my developers but it's difficult not having any experience in WF myself. Being able to start somewhere other than ground zero would be a tremendous help.
Thanks for any help.
December 02, 2005, 02:41 PM
<DocServices>
Hi,

Without knowing which WebFOCUS product and version you are going to use, it's hard to suggest additional resources that may be of help to you. Can you supply us with a little more information?

In the meantime, if you are using Developer Studio, you can try the Developer Studio Application Development Getting Started 7.1 manual (DN4500702.0905). If you need information on coding in the WebFOCUS language, you can refer to the Creating Reports With WebFOCUS Language 7.1 manual (DN4500695.0905).

You can view, download, and/or buy these manuals from i-Base: The Technical Documentation Library.

If you have an InfoResponse ID, log on to the Tech Support Web site and then access i-Base. By logging in first, you can download the PDF file and/or view the HTMLHelp version.

Of course, this forum is another great resource to use while developing!

Hope this helps.

Best,
Jenn

This message has been edited. Last edited by: <DocServices>,
December 06, 2005, 09:26 AM
dlb
Thanks Jenn.

We are on 5.2.x and are primarily using the Developer Studio. We've had some IBI consultants come in and they did most of their work outside the tools, so we do have some reports that are hand-coded.

We do have the manuals you've referenced for our version, but I'm looking for something that is less of a how-to manual and more of a standards manual. Something that contains best practices, tips and traps, things to do and things not to do, things that help or hinder performance. Also, things make a program more maintainable such as naming conventions, when to use what type of coding structures and consistent documentation methods . For instance, in the Java world, we took Sun's Code Conventions for the Java Programming Language (http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html) and modified them to meet our needs.

As everyone knows, in almost any programming language there are multiple ways to do most anything. By standardizing our development, we can cut the cost of maintenance over the long term and lower the total cost of ownership.

The people at my local IBI office don't know of such a document if IBI publishes it, but as you mentioned, I hope that someone in the user community has already gone through this and can help a new shop get a leg up.

Thanks again for the tips and I appreciate the time.

This message has been edited. Last edited by: dlb,
December 09, 2005, 02:43 PM
Johnny5
We had asked for the same thing when we first started. If there is one it must be locked in a vault somewhere. The basic documentation is decent but you will probably find that you'll need to find what works best for your organization. Not everything will work from within the painter and not everyone will want to work in the code itself. That balance point is key in my mind between maintenance, flexability and the ability to find resources that can support your appliations on a small learning curve.


WF 5.3.5 / SOLARS 2.9 / Apache / Tomcat / Oracle (9.2/10g)
December 09, 2005, 03:14 PM
Lloyd
Me being a fairly new WF developer myself (can't remember when I started the way overdue project!!!), what I can recomend most is:

A. Keep this forum at arms length, its invaluable. Make Friends, these guys have kept me going for the past year. I probably would've given up by now if not for their eagerness to help out.

B.Patience, WF seems to be a huge product/language that has a lot great features but also what some would call bugs.

C.Goto Info response and downlaod the old news letters, conference notes, etc. And read them. It will set your mind on how most use WF, and what techniques seem to work in the real world.

D.Patience, I have worked in many diferent environments and on many different languages, and WF is unlike any of them.

E. Read the manuals very carefully, these manuals are pretty generic because they cover so much, so some things don't apply to all platforms.

F.Patience, (get my point Big Grin)


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
December 09, 2005, 03:24 PM
<DocServices>
Hi,

We do not have one general manual that covers these topics but I can suggest the following Best Practices Guides:
You can also try the tutorials in:

Hope this helps.

Regards,
Jenn

This message has been edited. Last edited by: <DocServices>,
January 11, 2006, 01:30 PM
dlb
Thanks to all for your insights. And to Lloyd's point, as we start a new project using WF for something more than a report writer, I'll keep your group handy. And try to pass along any knowledge we gain in the process.

Would anyone be interested in collaborating on a community WF standards/best practices document?
January 11, 2006, 03:20 PM
<RickW>
I've been coding for 15+ years in FOCUS and don't recall seeing any type of coding standards. The language can be pretty flexible.

Since you're using WebFOCUS; I won't go in the wayback machine and talk about .INIT or MODIFYTALK (ugh) or go into general programming tips (like "use comments", key fields for selection criteria, etc.).

I really don't use the GUI tools too much. I think a lot of the old-timers hand code. Here's some quick tips off the top of my head and in no particular order ;

1. -SET &ECHO = ALL; is your friend for debugging code. Some use -SET &ECHO = ON;

2. TABLEF instead of TABLE - doesn't create an internal matrix - MAY be faster. We tend to execute a lot of stored procedures and I usually just TABLEF FILE SQLOUT PRINT * ON TABLE HOLD and work off the HOLD file.

3. -DEFAULTS - use these all the time for default DM (Dialogue Manager) variable values. Also helps with testing.

4. I usually use &RECORDS (sometimes &LINES) to check for no data situations and generate a "no data" report with the selection criteria.

5. SET PRINTPLUS=ON - MAY help if your geenrating PDFs and are getting formatting issues.

6. -RUN - I tend to use these a lot to "pop the stack" - helps for debugging a very large program but you probably DON'T want to use it in the middle of a DM loop.

7. EX(EC) vs. -INCLUDE - I use the EX more like a procedure (in VB speak) and -INCLUDE for common code. I try not not to go too nuts with the -INCLUDEs because it can be more of a pain to maintain.

8. Smartdates - use them - they are good and can make life easier. period.

9. APP PREPENDPATH xxx - where xxx is your project - ensures you're hitting your project folder first.

10. Here's an example of a useful DM loop within the stylesheet code section:

$ blank out zeros for values
-SET &CNTRW=1;
-REPEAT LOOPW 20 TIMES
TYPE=DATA, COLUMN=P&CNTRW,COLOR='WHITE',WHEN=P&CNTRW EQ 0,$
-SET &CNTRW=&CNTRW+1;
-LOOPW

11. Some standard environment settings I'm currently using (YMMV);
SET EMPTYREPORT = ON, ASNAMES=ON, NODATA = ' ', %STRICTMATH = OLD, ALL=ON

There are tons more but I have to get back to work <Wink

Good luck and have fun!!!
January 20, 2006, 04:26 PM
JimRice
Hi RickW,

We are moving from a VMS FOCUS shop to a WebFocus shop. We currently code
most of our FEXs by hand and run a lot of batch jobs to create reports and
extract files. These batch jobs are monitored by operators via a command console
where errors and messages can be responded to accordingly.

I have been using Focus for many years(mostly IBM mainframe), but I'm relatively
new to WebFocus(less than a year).

We currently have:

WebFocus Dev Studio - Version 526
WebFocus 524 Server - Windows NT 5.2
Report Caster

We have several developers that each have a folder in a default domain folder
in the Managed Reporting Repository. I'm not sure this is where we should be
maintaining our FEXs......so here's a few questions(for anyone)

1) Where(in WebFocus) should we be maintaining our Focus Code(FEXs)?

2) Are there any naming conventions that anyone has used to help coordinate projects
in a multiple developer environment?

3) Is Report Caster the best tool for scheduling batch processes, and if not, what are
some alternatives. Responding to errors or messages is a concern.

4) Do most shops work with auto-generated master file descriptions or do they maintain
them by hand?

5) Should we be using the GUI tools to develop code?

Thanks for any comments,
Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
January 23, 2006, 11:40 AM
<RickW>
Jim,

1. at my current client site we do not use MRE at all but certainly use Developer Studio Projects. They work great to separate out all the kibbles and bits of a project (FEX, MAS, GIFs, etc).

2. We tend to use a several character prefix on our programs to help as a unique identifer. This REALLY comes in handy when using ReportCaster as well as being able to quickly identify the app.

3. ReportCaster works great - that's what we use. I suppose if you were on a UNIX environment you could do a cron script - because all us geeks know UNIX is awesome Wink - but RC works just fine. I think 7.1 version has some useful enhancements but I haven't gotten to play with it yet.

4. We use the autogenerated Masters going against MSSQL tables - works great - less filling.

5. Personally, I think the GUI tools are good for noobs. I think once you develop reports in the GUI you'll end up being committed to it since making changes by hand could be troublesome. Hand coding to me makes much more cleaner, readable, and easier to debug code.

I think if someone is a WF programmer (not an end-user type) it's absolutely imperative that they know how to hand code. I think people are kidding themselves if they think they can develop complex applications or reports all via the GUI tools. IMHO, to be an effective developer you MUST have a decent knowledge of the FOCUS language - period.

My rant for the day Wink - hope that helps.
January 23, 2006, 03:09 PM
Prarie
Being a long time FOCUS Programmer myself..I totally agree you have to know the FOCUS language to be a WebFocus Programmer. I rarely use the GUI...but it does some great stuff. But a good lesson on the Language is a must for a new person. WebFocus is not marketed that way. Good Luck.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Hi All,

I'm still trying to establish a naming standard (.fex, .mas, .htm, etc) for our WebFocus development environment. I'm still a little confused if you need to maintain a standard that is only 8 characters long. Could some of you that have used WF a long time and developed a workable standard please share this with the forum. I know there are probably many different opinions on this but let's post a few and see what happens.

Thanks in advance!

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
We need to know what your environment is, Jim.
Can you edit your profile to say in your signature?
for ex, in a selfserve site, your htm file nomenclature is entirely up to you, long names are fine.
Includable files (for asp pages) can have long names.
masters, as far as i know, are 8, or can be shorter.
focus dbs can be long names, just make them contiguous alphanumeric characters. Fexes can be longer than 8, i have them at 12, but if you use MRE to build them (at least in 528), the 8 character limit is imposed by MRE.
I have over 600 fexes in production, all in MRE, and don't find the 8 char limit a problem, actually it helps me be concise. I build intelligence into the 8 character name the same way my company builds intell into its product codes. The long names that appear in the MRE Domain Builder interface are more than sufficient to be informative. the trick is, if you're using MRE Domain builder, to create your NEW fex with the 8 character name it will have, then in the properties box, re-edit the long name to be fully informative to you. The true fex name won't change when the properties description long name is edited. very nice feature, very nice! I put sequence numbers on my long names.
eg. if a fex is named INVETL01 (meaning, inventory etl first program), then the long name is "1.0 inventory etl MTWTF" and in domain builder the fex names will be sorted in the order of that long name. very nice.
any help?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Hi Sue,

I updated my profile. Let me know if there is anything else I should update.

Thanks for all of your posts to this forum. It's always interesting to see how other people are using Focus in the real world.

I've been developing most of my code in MRE so I know about the 8 character limit there, but I was curious if there was any reason to stay with 8 characters if you are developing up in the applications folder. Do you prefer working in MRE? You have to be in the app folders for a self-serve app correct?

I pretty much code everything by hand. Would you recommend using some or any of the GUI tools? What editor do you use or is this even an option?

Are you happy with ReportCaster? So far, I'm just using it to kick off my fexs. I don't really use it to distibute reports and we don't have the reporting repository. How do you handle notifying someone if a RC job encounters an error?

Sorry for all the questions, but I really value your opinion.

Thanks Again!


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
1. i'm totally mre, i love the interface in domain builder. i only devstu on my laptop, not in production.
2. self serv launch pages are totally outside of the mre universe; they fexes they call can be anywhere...mre or some dev stu app thing...if the fexes they call are not in mre, then you have no 8 char restriction.
3. i hand code directly in domain builder in mre, use TEXTPAD for printing out the fexes with line numbers, etc. Some of my colleagues like UltraEdit..also cool; Gui tools are fabulously great for learning reporting;
4. over the moon with report caster; there's a notify feature in caster to send an email if there's an error; it emails my phone if there's a problem. i use caster to schedule all my database updates, ftp site retrievals, drop-down list updates, and colorful html emails (drill-down enabled) for all sorts of things. I never send attachments in an email...my users won't open them.

This message has been edited. Last edited by: susannah,




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
What about report requests? Do you guys have any spec sheet that your users fill out when they want a new report?

Also, what about naming conventions within MRE? We are using DevStudio 7.1.4 now, still trying to come up with our standards... ie: defined fields will be df_[name of field], computed fields will be cp_[name of field], etc. With procedures, I've seen suggestions of the type of report, such as a Shipping report being SHP10000.fex, and the drill down being SHP11000.fex. Any thoughts there?


Prod: WebFOCUS 7.1.6 - on Win 2K3/Tomcat - MRE/BID/RCaster/VisDis and AS400 (JDEWorld)
ocean, your nomenclature plan for your fexes is a good one. i would suggest giving yourself a little more wiggle room
SHP01000
and
SHP01010
and when you're in development
SHP0101x




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Thanks for your response -- not sure I follow the development part though -- wouldn't the name stay the same when moved to production?


Prod: WebFOCUS 7.1.6 - on Win 2K3/Tomcat - MRE/BID/RCaster/VisDis and AS400 (JDEWorld)
well, its up to you. if you're developing a new and improved version of 1010, then you'ld just copy the code over the existing code.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
We use a single character at the end of the report name to signify what type of report it is. "d" for detail report, "b" for bar graph, "p" for pie chart.

We've just started doing it on a new project but it's worked out really well so far.
Thanks EGL - that's a thought, too... we're having this discussion today, so if we come up with anything else, I'll post here for future users looking for the same thing.


Prod: WebFOCUS 7.1.6 - on Win 2K3/Tomcat - MRE/BID/RCaster/VisDis and AS400 (JDEWorld)