There's an interesting blog post by Dennis Vorst gone up on the Uniface.info blog, titled Where to put your code. As the title suggests, it's about which places are best for different types of code, based on their content.
There are a number of options; conceptual at the entity or field level, locally at the entity or field level, within the component, a local procedure or a global procedure. All of these have their merits.
I've posted my response, defending the mighty global procedure, but why don't you have a read and add your opinion in the comments?
Summary: Check out this blog post... http://unifaceinfo.com/where-to-put-your-code
Showing posts with label code. Show all posts
Showing posts with label code. Show all posts
Friday, 24 July 2015
Tuesday, 30 September 2014
Rosetta Code
Recently I was pointed an interesting website, or at least, I thought it was interesting. And that's Rosetta Code. I'll let them describe what it's all about...
Surprise, surprise; Uniface was nowhere to be seen. So I've rectified that problem, and added Uniface to the list of programming languages.
I didn't have a lot of time on my hands, so I cheated and copied the contents from Wikipedia, in order to create the base page. Some of the content is out of date, as it still lists Uniface as a Compuware product, but it's a start.
The idea now is to go through and complete some of the tasks not yet implemented in Uniface, which is currently all of them! I plan to devote a little bit of time to this myself, but I guess this is a bit of a call out to Uniface developers - go forth and complete tasks!
Summary: Rosetta Code looks like an interesting site for comparing different languages, but Uniface examples are non-existent.
Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another.
Surprise, surprise; Uniface was nowhere to be seen. So I've rectified that problem, and added Uniface to the list of programming languages.
I didn't have a lot of time on my hands, so I cheated and copied the contents from Wikipedia, in order to create the base page. Some of the content is out of date, as it still lists Uniface as a Compuware product, but it's a start.
The idea now is to go through and complete some of the tasks not yet implemented in Uniface, which is currently all of them! I plan to devote a little bit of time to this myself, but I guess this is a bit of a call out to Uniface developers - go forth and complete tasks!
Summary: Rosetta Code looks like an interesting site for comparing different languages, but Uniface examples are non-existent.
Labels:
chrestomathy,
code,
compuware,
examples,
languages,
programming,
rosetta code,
tasks,
uniface,
wikipedia
Wednesday, 19 September 2012
Splitting long lines of code
In javascript, for example, white space is pretty much ignored by the interpretor. You can spread your code over as many lines as you think makes it more readable, just don't forget to indicate the end of the line with a semi-colon. However, Uniface doesn't allow this, it uses the carriage return as the end of line character. So what do you do if you have a really long line of code?
Well, for me, I tend to just leave it as a very long line of code. If it gets too long, I'll ask my boss for an even bigger monitor :)
I suffer a little with this practice when I'm developing on my laptop though, as I was yesterday. This reminded me about something that I've seen used before, and that's using a Uniface feature that allows you to split a single line of code over multiple lines, like this...
I'm sure this is something that's documented, but what do you search for to find it? I certainly couldn't find anything. So here's a little tip for you, if you prefer to keep those lines a little shorter.
One situation I have used it in before is with a long SQL command or selectdb statement, as it can help to format it in a similar way to how you might write the SQL in your favourite database tool. For example...
EDIT: Uniface calls this the "Line Continuation Marker" and it is documented as such.
If anyone knows where this is in the manuals, please leave a comment and let me know.
Summary: It is possible to split a single line of code over multiple lines in Uniface, but you have to do it explicitly.
Well, for me, I tend to just leave it as a very long line of code. If it gets too long, I'll ask my boss for an even bigger monitor :)
I suffer a little with this practice when I'm developing on my laptop though, as I was yesterday. This reminded me about something that I've seen used before, and that's using a Uniface feature that allows you to split a single line of code over multiple lines, like this...
if ( value != "1" & value != "2" & value != "3" & %\
value != "4" & value != "5" & value != "6" & %\
value != "7" & value != "8" & value != "9" )
value = "0"
endif
I'm sure this is something that's documented, but what do you search for to find it? I certainly couldn't find anything. So here's a little tip for you, if you prefer to keep those lines a little shorter.
One situation I have used it in before is with a long SQL command or selectdb statement, as it can help to format it in a similar way to how you might write the SQL in your favourite database tool. For example...
selectdb max(field6) from
"entity"
u_where
( %\
(field1 = value1)
& %\
(field2 = value2)
& %\
(field3 = value3)
& %\
(field4 = value4)
& %\
(field5 = value5)) to (value6)
EDIT: Uniface calls this the "Line Continuation Marker" and it is documented as such.
Summary: It is possible to split a single line of code over multiple lines in Uniface, but you have to do it explicitly.
Subscribe to:
Posts (Atom)