[jawsscripts] Re: ultimate get hierarchy function, a nomenclature coding practise query?

  • From: "Jim Snowbarger" <Snowman@xxxxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Thu, 24 Oct 2013 21:39:41 -0500

That's a good question, John.  You were providing a gift, and you get 
trounced about your coding style.  Incredible.  I shake my head.

Honestly, of all the annoyances I find in other people's code, that lack of 
hungarian notation is probably the least of them.
Lack of indentation, a favorite of blinks, is a big one.
Variable names that don't speak nicely, devoid of vowels a favorite of my 
sightie colleagues is another.
Lack of good, logical functional decomposition is another.  You know,  code 
that just goes on and on and on and on?

No comments on obscure constructs, or Inane comments that just repeat 
obvious things about the code is another.
Good commenting is definitely an art, much as is the skill of writing good, 
understandable documentation in general.
The key is to be able to anticipate what it is about what you are doing that 
might be allusive to another, sufficiently skilled int he art.
Too many comments are as bad as none.  That's part of why I added 
functionality to my version of script manager scripts that lets you skip 
them.






----- Original Message ----- 
From: "John Martyn" <johnrobertmartyn@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Thursday, October 24, 2013 1:59 AM
Subject: [jawsscripts] Re: ultimate get hierarchy function, a nomenclature 
coding practise query?


Good point Jim. I program in several languages and this is just one of those 
preferences. Question though, why do I cause such a fuss every time I post 
some crazy function? Lol
John

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx 
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Jim Snowbarger
Sent: Wednesday, October 23, 2013 8:12 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: ultimate get hierarchy function, a nomenclature 
coding practise query?

Oh, you probably need to interview for a more valuable talent than tidiness.
<grin>
But, these points are valid, about increasing maintainability by using 
constants.  One can go overboard about that.  But, in my early days, I would 
find myself using a number, and then stating the meaning of the number in 
comments.  It finally occurred to me that that was silly.  I might as well 
conform the comment into a constant name, and get the added benefit of 
changing it in one place if the constant will be used multiple times.
Even if only used once, it doe sgive more obvious meaning to the number.
But, I still find times when just using a number, which I have reason to 
think will never change, can improve and simplify readability.  Then, there 
is the problem of name space.  And, making sure that the correct constant 
gets used with the correct variable, and all that.  So, your names can get 
long and obfuscated, which also inteferes with readability.
As a long time programmer of over 35 years,  I still find that good 
programmer judgment trumps cut and dried rule books.



----- Original Message -----
From: "Soronel Haetir" <soronel.haetir@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Wednesday, October 23, 2013 12:03 PM
Subject: [jawsscripts] Re: ultimate get hierarchy function, a nomenclature 
coding practise query?


Sorry, I can understand not using Hungarian notation but using the 
underlying numeric constants instead of more meaningful text labels is 
really poor practice in my book.  Sure it takes a little bit longer to type 
but it takes _so_ much less time to remember what the hell code is supposed 
to be doing.  Or if the value has to change for some reason (unlikely I 
admit in this particular case, but then you don't generally pick  such usage 
based on the instant case before you but the entire universe of them) you 
don't suddenly have to go hunting through your code for occurrences of "3" 
and decide whether it's one of the ones that has to change or not.

If I were conducting a job interview and had someone pull that kind of thing 
I would probably recommend against hiring based on that item alone, to me it 
simply speaks to _extremely_ sloppy thinking, and sloppy thinking is one 
thing programming simply cannot tolerate.

On 10/23/13, John Martyn <johnrobertmartyn@xxxxxxxxx> wrote:
> Thanks Jim and Jeff, I know sometimes my code is sloppy, and I get
> lazy coding. I'd rather place a 3 instead of writing OT_JAWS_Message
> every time.
> That's what really did it for me.
> John Martyn
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Jim Snowbarger
> Sent: Tuesday, October 22, 2013 6:31 PM
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: ultimate get hierarchy function, a
> nomenclature coding practise query?
>
> Take Heart, John. I think we talked about this a while back.
> Personally, I never use the practice, since the identity of the
> quantity being referenced is usually more important to me, as the
> reader than it's type.  I grow tired of hearing i this and i that, as
> I'm reading my code.
> It's an unnecessary syllable, and distracts my minimal brain from
> focusing on content.
> I say let the compiler deal with data types, when necesary.
>
> ----- Original Message -----
> From: "Geoff Chapman" <gch@xxxxxxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Monday, October 21, 2013 11:02 PM
> Subject: [jawsscripts] Re: ultimate get hierarchy function, a
> nomenclature coding practise query?
>
>
> Hi John.
>
>
> Man in squizzing through your amazing-looking and generous code
> offering below, I'm just wondering, is there a particular reason why,
> you seem to have chosen not to have adopted what I understood to be
> the standard FS scripting variable nomenclature convention? (Or mostly
> standard anyway,) of beginning all variables with a prefix of a small
> case variable type?  To help readily alert/reinforce to the
> code-follower, what each variable is holding, when it's type is not
> next to it? as of course it is in it's initial declaration  phase?
>
> as in,
> i for integer, s for string, h for handle, o for object, etc?
>
> Of course I've frustratingly seen how sometimes they don't seem to
> keep to their own standards, in that they'll use n for number, instead
> of i for integer, which I've know idea why this hasn't been internally
> clamped down on a bit more strictly, since in my perhaps green-horne
> view, following guidelines consistently just makes it sooo much easier
> for average bears to grab ahold of what's going on I reckon.
>
> But, obviously this is not something you have chosen to adopt for your
> own coding practises.
>
> without wishing to raise any hackles or appear in the least ungrateful
> for your no doubt hard-slogged code submissions to us here, :) looking
> through it a little, it just did beg the question for me, to at least
> wanna ask up here, to see how many others felt this was deemed by the
> majority, a worthwhile/important procedure to follow as a practise, or 
> not?
>
> E.g. I wasn't immediately confident that I understood what the T's,
> and C's, in some of your variable names, referred to?
>
> unless they connoted purpose rather than type? e.g. t for target, c
> for class maybe? ...
>
> Thoughts?
>
> Thanks much.
>
> Regards
> Geoff c.
>
> ----- Original Message -----
> From: "John Martyn" <johnrobertmartyn@xxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Tuesday, October 22, 2013 1:31 PM
> Subject: [jawsscripts] ultimate get hierarchy function
>
>
>> Hope thjis helps. Specify the class and window hierarchy positions
>> and it will search for the correct window handle. Also a skip count is 
>> required.
>> A skip count of 1 indicates finding the first item. If no window
>> class just pass "".
>>
>> HANDLE Function GetHTarget (string tWinClassName, int tY, int tX, int
>> skip)
>> var
>> handle cWin,
>> string cWinName,
>> string cWinClassName,
>> handle nWin,
>> string direction,
>> handle childWin,
>> handle parentWin,
>> string converted,
>> int flagged,
>> int continue,
>> int safety,
>> int classFlag,
>> int cX,
>> int cY,
>> int theCount
>>
>> let cWin = ApplicationMainWindow
>> let flagged = 0
>> let direction = "down"
>> let continue =0
>> let classFlag = 1
>>
>> while continue== 0
>>
>> if cWin == ApplicationMainWindow then if flagged == 1 then ;Say ("The
>> specified window was not found",3) return endif let flagged = 1 let
>> cWin = GetFirstChild (cWin) let cWinClassName = GetWindowClass (cWin)
>> let cX = GetWindowHierarchyX (cWin) let cY = GetWindowHierarchyY
>> (cWin) else
>>
>> if direction == "down" then
>> let childWin = GetFirstChild (cWin)
>> if childWin == 0 then
>> let nWin = GetNextWindow (cWin)
>> if nWin == 0 then
>> let direction = "up"
>> let cWin = GetParent (cWin)
>> let cWinClassName = GetWindowClass (cWin) let cX =
>> GetWindowHierarchyX (cWin) let cY = GetWindowHierarchyY (cWin) else
>> let cWin = nWin let cWinClassName = GetWindowClass (cWin) let cX =
>> GetWindowHierarchyX (cWin) let cY = GetWindowHierarchyY (cWin)
>> ;SayString ("next window") endif else let cWin = childWin let
>> cWinClassName = GetWindowClass (cWin) let cX = GetWindowHierarchyX
>> (cWin) let cY = GetWindowHierarchyY (cWin) ;SayString ("next child")
>> endif elif direction == "up" then let nWin = GetNextWindow (cWin) if
>> nWin == 0 then let direction = "up"
>> let cWin = GetParent (cWin)
>> let cWinClassName = GetWindowClass (cWin) let cX =
>> GetWindowHierarchyX (cWin) let cY = GetWindowHierarchyY (cWin) else
>> let cWin = nWin let cWinClassName = GetWindowClass (cWin) let cX =
>> GetWindowHierarchyX (cWin) let cY = GetWindowHierarchyY (cWin)
>> ;SayString ("next parent") let direction = "down"
>> endif
>> endif
>> endif
>>
>> let cWinName = GetWindowName (cWin)
>> ;Say (cWinName, 3)
>> ;sayinteger(cX)
>> let safety = safety + 1
>>
>> if cX == tX && cY == tY && StringCompare (tWinClassName ,
>> GetWindowClass(cWin), 0) == 0 then
>> let theCount= theCount+1
>> if theCount == skip then
>> ;SayString ("The window has been found")
>> ;Say (cWinName, 3)
>> ;sayinteger(cWin)
>>
>> let continue = 1
>> return cWin
>> endif
>> endif
>> if safety == 500 then
>> ;SayString ("safety has been triggered")
>> return
>> endif
>> endwhile
>>
>> endfunction
>>
>>
>> Peace out,
>> John Martyn
>>
>> -----Original Message-----
>> From: jawsscripts-bounce@xxxxxxxxxxxxx
>> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Stefan Moisei
>> Sent: Saturday, October 19, 2013 8:15 PM
>> To: jawsscripts@xxxxxxxxxxxxx
>> Subject: [jawsscripts] Re: How to retrieve WindowHierarchyX
>>
>> Hi,
>> You can try the
>> GetWindowHierarchyX and GetWindowHierarchyY functions. They are
>> documented
>> in the fsdn.
>> -----Original Message-----
>> From: Javad Hoseini
>> Sent: Sunday, October 20, 2013 1:09 AM
>> To: jawsscripts@xxxxxxxxxxxxx
>> Subject: [jawsscripts] How to retrieve WindowHierarchyX
>>
>> Hello
>> I am trying to identify the window information of some buttons in a piece
>> of software, but none of the identifications seems to be unique, except
>> WindowHierarchyX and WindowHierarchyY
>>
>> But I don't know how to retrieve this parameter with a function or
>> something. What should I do?
>>
>> Javad Hoseini
>>
>> انجمن پژوهشي آسيب هاي بينايي (راوي)
>> Research Association for Visual Impairments www.IranRAVI.com
>> Skype: javad2625
>>
>> __________
>>
>> View the list's information and change your settings at
>> //www.freelists.org/list/jawsscripts
>>
>> __________
>>
>> View the list's information and change your settings at
>> //www.freelists.org/list/jawsscripts
>>
>> __________
>>
>> View the list's information and change your settings at
>> //www.freelists.org/list/jawsscripts
>>
>
> __________
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
>
>
> __________
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
> __________
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
>


-- 
Soronel Haetir
soronel.haetir@xxxxxxxxx
__________

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts



__________

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts


__________�

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts



__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: