Some WinDev code
OK - when I am learning a new language I read through the documentation on the various built in functions (this is the rule I violated this time). I wanted to be able to convert a date to the day of the week, and never having run across a language that had it built in, I went out and looked for code in Google to accomplish the task. I found some code posted in Pascal and converted it to WinDev -- it was a good learning exercise. Then I found the DateToDay() function, which does the same thing. So, here is the code as an example of what WinDev code looks like:
PROCEDURE DayOfWeek(Year, Month, Day are int)
Century, Holder, RetVal are int
IF (Year <> 12) OR (Day <> 31) THEN
RESULT -1 // Return -1 to indicate an error
ELSE
// Do the Zeller's Congruence calculation as Zeller himself }
// described it in "Acta Mathematica" #7, Stockhold, 1887. }
Century = IntegerPart(Year / 100)
Year = modulo(Year, 100)
// Next we adjust the month such that March remains month #3,
// but that January and February are months #13 and #14,
// *but of the previous year*: }
IF Month < face="courier new" size="1">Month += 12
IF Year > 0 THEN
Year -= 1
ELSE
// The year before 2000 is 1999, not 20-1...}
Year = 99
Century -= 1
END
END
//{ Here's Zeller's seminal black magic: }
Holder = Day
// Start With the day of month
Holder = Holder + IntegerPart(((Month + 1) * 26) / 10)
// Calc the increment
Holder = Holder + Year
// Add in the year
Holder = Holder + IntegerPart(Year / 4)
// Correct For leap years
Holder = Holder + IntegerPart(Century / 4)
// Correct For century years
Holder = Holder - Century - Century
WHILE Holder < 3
// Get negative values up into
// positive territory before
// taking the MOD...
Holder += 7
END
// taking the MOD...
Holder = modulo(Holder, 7)
// Divide by 7 but keep the
// remainder rather than the quotient
IF Holder = 0 THEN
// Here we "wrap" Saturday around to be the last day
Holder = 7
END
// Return the end product!
RESULT ExtractString"Sun/Mon/Tue/Wed/Thu/Fri/Sat",Holder,"/")
END
Sorry about the lack of indentation - the blog editor stripped them out!!
Back again with observations on the W language
Finally back at work with WinDev -- not really a comparison to Clarion any more. I gave my copy to the company that had been buying my services for a couple of years -- so, now I am writing software mostly to see if I can resell it at some future date rather than as a contractor.
A few things I have found ... there are a 'ton' of routines. I am slowly printing them out after converting over 2000 pages of functions documentation from chm to pdf. For learning the capabilities of a language I still prefer paper to on-screen documentation. After going through them I am beginning to undrstand the 'philosophy' of the 'W' language. I am also seeing that the grouping of the functions 'may' make more sense in French than in English ... but the jury is still out on that one.
Three things I have found so far: 1) US time, with AM and PM, is not handled as well as I would like. Hope they make some progress on this in version 9 and 2) Supercontrols can cause browse order problems in a window, and 3) I keep wanting more places to insert code but then realize that having just a few makes development easier in the long run.
It is taking some time for me to get over the 'Why don't they do this like Clarion' syndrome. But, as time goes on, I see more and more that the WinDev way is different, but IMHO in most cases, better. My only wish is that the English market was big enough for PCSoft to be able to invest more into the English version. I am feeling jealous of the French programmers.
November 15, 2004 - ODBC and Linux MySQL
Tried four versions of Linux and found Fedora Core 3 to be the most stable of the lot - the WinDev native MySQL driver connected to the MySQL server on the Linux box with no problems. Also checked out the ODBC driver for Hyperfile using OpenOffice - Issued a query against a table and the ODBC driver returned the proper information. My only complaint is that the ODBC driver is one place where the translation to English is not complete. Not only is the ODBC setup screen still in French, but so are the error message dialogs if you submit an improper query -- I don't mind for myself, but I would like my customers to see English messages because they are going to assume that I am the one who decided the messages should be in French. Not a big deal -- I'm just glad the connectivity is there and will hope this is corrected in version 9.0.
November 14, 2004 - The new paradyme
Sorry for the delay folks, occasionally real work gets in the way. Got a call for another contract in an older system I worked with before Clarion, a database system called Pick, Universe, Unidata, Revelation or Open Insight, depending on the flavour of the moment.
Got me thinking that during my 24 years in this business, there have always been a class of tools that existed alongside the more popular tools from IBM or Microsoft or Borland. They have always been oriented toward the business programmer. Twenty years ago it was a product called Revelation (Later AREV), which was built using the paradyme of an earlier mini-computer OS called Pick. Between 1985 to 1990 it became a tool that could be used to quickly develop business applications on the PC. In the AREV incarnation it provided everything needed for business database development in one product ... better than the dBase, Paradox and Dataflex of that time ... and much quicker to develop than PDS basic, Borland Pascal, et. al.
Others in this group have included Magic and Clarion.
Now the concept of 'design before code' has become the norm. The 2-tier and 3-tier design methodologies are replacing the mainframe based 1-tier designs that dominated for 30 years. However most of the tool sets used to design these modern, very complex systems are unbearable to those of us who got used to truely integrated tool kits in the PC DOS days.
Clarion, Open Insight and Magic were three tools who were moderately successful in bringing this paradyme to the Windows development world. As the Windows API grew and grew, making complex internal development more and more out of reach for all but the biggest companies, these tools have been a refuge for at least some of the tasks of rapid business database development.
I will have to say that, with the possible exception of the Clarion templates like Ultra Tree, the totally integrated approach of WinDev brings back the best of the quick development possible with AREV in 1990 and additionally adds many new possiblities that AREV could not have considered.
November 5 - Importing an MS Access Database
This works, mostly. I designed a small two table access database and a related form. The form had a group of tabs and one of the tabs had a sub-form on it.
Everything was imported except the subform on the master form; the data, the form layouts, the relationships between forms, everything.
The subform was imported as a separate form.
One limitation is that Microsoft Access has to be loaded on the computer doing the importing. You can't just take and .mdb and import the contents - it apparently communicates with Access to extract the data.
Also, thanks for the postings about the MySQL driver and the Modifier -- hadn't found that yet. Will try that again later.
More later ...
November 4, 2004 - And a few things I don't like ...
Sorry I haven't been around for a few days. I was involved with the US election as a poll watcher. Won't say anything about my politics other than I might be open to a four year gig in Europe if one came along. OK, enough of that - now a few things that I wish were different about WinDev.
1) I prefer property sheets - the 7 tabs are OK, but I still prefer property sheets.
2) I wish the native MySQL driver worked out of the box. I installed MySQL on a server, I installed the driver. Things seem to be working fine until an SQL statement gets generated and I get an 'invalid SQL syntax' message. Now I am sure there is a simple fix, but I wish I didn't have to work to find it on what I consider a basic feature.
3) I have also been reading messages that talk about problems with the ODBC drivers. Don't know if it's true yet. But data access is the one thing that should be bullet proof out of the box on a database based environment.
Will get back with more soon, but still trying to dig out of my election day hole!
October 29 - Everything open at once!!
One of the things I have always hated about the Clarion environment is the fact that when you are screen painting or code writing or dictionary building you are locked out of other functions. Everything is open, open, open, close, close, close, open something else, etc.
I have started the WinDev tutorial and all of a sudden it came to me ... I have an analysis, a project definition, a window layout, an SQL statement and a report all open at the same time ... and I can switch between them as needed --- wow, what a concept. So the question now is is WinDev just a pretty face hiding a vapid and useless interior, or does this magnificent exterior intimate a equally lustrous interior?
Only time will tell ...
October 29, 2004 - Project control center (yippee)
I looooove the project control center. I also love the analysis screen.
The project control center keeps track 0f all the elements of the project; sql queries, screens, reports, batch processes, exports - you name it, it's here. Everything is laid out visually and the representations on this screen are mini versions of your screens, reports, etc -- so no forgetting what the name you gave a process was and having to open item after item to look at the screen and see if it is the one you wanted. There is also a little mini-viewer for large projects that has a little moving transparent box showing you what part of the project tree you are looking at.
The analysis screen is where you view the database structure. All the tables are there with the traditional 1:1 1:M M:1 notations. It is the Clarion Data Modeller the way it should be done. Again the little transparent box showing you what part of the larger database analysis is currently being displayed.
The price of the product is paid for with these two tools alone, even if I never actually created an app in WinDev.
Other things I really like:
The maintenance tool that is included with WinDev. It has a pleasing visual layout and provides a central control center for 23 different tools. These include things like a setup builder, file maintenance, test application creation (build scripts to test your app after changes to see it still works properly), version control. zip archive tool and many others.
The ODBC driver for hyperfile databases is freely distributable. This points to one of the things I find myself really liking about WinDev. The tools you need come with the base package. The only things you pay extra for are native drivers for databases like Oracle, translation tools for multi-language programming and an end user report writing tool that is not available in English yet. Everything else is included in the base package for about the same price as Clarion Enterprise Edition and a fraction of tools such as Magic.