[nvda-addons] Re: Developing Addons - The best way to get started?

  • From: "Damien Sykes-Pendleton" <damien@xxxxxxxxxxxxxxxxxxxx>
  • To: <nvda-addons@xxxxxxxxxxxxx>
  • Date: Fri, 8 Apr 2016 18:43:26 +0100

Hi Brandon,
BGT has object oriented concepts which I have used – classes, objects, 
inheritance, interfaces, operator and function overloading, function callbacks 
etc.
Also I did install a C/C++ compiler and learned a fair bit about C and C++, but 
had a lot of trouble with compiling, especially when it came to using external 
libraries.
BASIC is a scripting language, but it can’t be compared with BGT. BASIC has 
full support for libraries, cross platform applications, portability, and, 
especially the compiler I use, compiles into native machine code, has support 
for several preprocessor statements, has support for the C runtime, recognises 
assembly code – the list goes on and on. I would personally say you can use it 
either as a scripting language or a full blown programming language depending 
on your preference. Granted, that, unfortunately, does not include object 
oriented concepts, at least to the level that BGT, and certainly C++ does, 
though it does have types, similar to C structs, that have their own 
constructors and destructors, properties and methods. It may also have 
overloaded methods, though I can’t remember as I rarely use them.
Named arguments: I’m assuming that’s where you can say 
some_function(parameter1=value1, parameter2=value2) If so I think PHP has this, 
and BGT certainly used to have it.
So yes, I am familiar with some of the concepts, they just seem differently 
laid out, explained and represented in Python.
If it’s just a case of relearning it then it shouldn’t be too much of an issue. 
Hopefully.
Thanks.
Kind regards,
Damien.


From: Brandon Keith Biggs 
Sent: Friday, April 08, 2016 5:28 PM
To: nvda-addons@xxxxxxxxxxxxx 
Subject: [nvda-addons] Re: Developing Addons - The best way to get started?

Hello,

Of corse, everyone has said that he should go through Learn Python the Hard 
Way. Follow the directions there and not just read. Everything from installing 
python to doing print statements to understanding OOP is covered there. Once he 
goes through that, then he can start with WX Python.

But of corse learning python is vital.

Python is a full language. It is called a "scripting language", but that is 
because of how clean the syntax are and how high level it is. It is really a 
full-blown programming language. BGT and any of the basic languages are true 
scripting languages. If you did manage to install the compiler for C++, and gon 
through a book to learn C++, then you would know another full-blown programming 
language.

Because you already know variables and include statements doesn't really mean 
you understand constructors, objects, inheritance or some of the awesome python 
features that other languages don't have like named arguments.

In order to use python, you need a text editor, which you should already have, 
if not use something like EdSharp, and python 2.7.11.

Thanks 


Brandon Keith Biggs

On Fri, Apr 8, 2016 at 8:31 AM, Damien Sykes-Pendleton 
<damien@xxxxxxxxxxxxxxxxxxxx> wrote:

  Hi James,
  Installing Python isn't the struggle. It's knowing what and what not to 
install. Python, and especially the NVDA codebase, seems to have so many 
components and subcomponents and subpackages and other things which don't make 
it remotely clear as to what is necessary and what is just extra blah.
  Of course Python compares nothing to small, area-based, sandbox scripting 
languages such as BGT, AutoIt, AutoHotkey etc. However it seems to relate more 
to C++, which has so many variants I ended up uninstalling it out of sheer 
frustration because it didn't work how I would expect a language to work, and 
not just in the way it presents information neither.
  My current everyday language is FreeBASIC which, though a fully fledged 
programming language, only installs the bare basics along with a bunch of 
helper headers so you can use various API's. All you have to do then is find 
the libraries you need. Modules are linked with #include, libraries are linked 
with #inclib, there you have it, compile yourself a nice executable program, 
run it, be happy. Python seems immeasurably different to that, both in the 
language and its components, and it's partly that difference that is 
frustrating. I want to be able to get to grips with it, but I've no idea where 
to even start.
  I don't know. Sometimes I don't even know myself exactly what the issue is. 
Sometimes I feel like I'm drinking a large glass of water and then it comes 
straight back out, or there's not enough of it to get to where I need to be. I 
feel like I'm taking one step forward and two steps back sometimes.
  Kind regards,
  Damien.

  -----Original Message----- From: James Scholes
  Sent: Friday, April 08, 2016 4:04 PM
  To: nvda-addons@xxxxxxxxxxxxx
  Subject: [nvda-addons] Re: Developing Addons - The best way to get started?

  Damien Sykes-Pendleton wrote:

    and the way it works with classes seems different as well (take for
    instance the class of AppModule(appModuleHandler.AppModule) which I
    believe refers to a class inheritance, looks like it is inheriting
    from a class property instead of another class).


  No.  appModuleHandler is a Python module, imported using:
  import appModuleHandler
  AppModule is a class defined in that module, thus,
  appModuleHandler.AppModule

  appModuleHandler has a lower case A, so it isn't a class.  Note that I'm
  not saying that starting your class names with a capital letter is a
  technical requirement, but it is a coding standard upheld by most Python
  programmers and can be seen throughout NVDA.  Instance variables,
  function/module names, all start with a lower case letter and use camel
  case.  This is all covered on the NVDA wiki on GitHub.


    For the most part learning a new language has been easy for me, since
    its only difference is usually with syntactical differences, but
    Python seems to change more concepts than just syntax, hence the
    reason I find it more confusing.


  The examples you mentioned, e.g. lists and dictionaries instead of
  arrays, is simply a case of differing termanology.  A list is an
  index-based array.  A dictionary is a key-based, or associative, array,
  similar to a hash map in other languages.


    I think that perhaps the other problem I am facing is that, because I
    generally wouldn't consider writing in Python in an everyday setting
    and thus would only use it for NVDA addons, and NVDA can
    automatically create the relevant files based on the source code, I
    haven't installed Python and therefore only have NVDA as a testing
    mechanism. I may be wrong, but I have thought before now that
    installing a whole component when you would possibly only use a minor
    percentage of it is rather pointless, especially if you then have to
    learn to run it as a full system. In this case Python, which relies
    on command line usage to run scripts, separate compilers to compile
    them to binary, and other dependencies for extra functionality etc.


  This is, of course, up to you, but if you want to write NVDA add-ons,
  you need a better understanding of Python than you apparently have now.
  If you don't want to take the couple of minutes it takes to download
  the Python installer and try out the interpreter, there's probably not a
  lot any of us can do to help you.  Also, Python is, at least not in the
  default cPython variant, a compiled language.  Other versions of Python
  have just-in-time compilers, but NVDA doesn't use or run under any of
  those other versions, so you don't need to concern yourself with them.
  -- 
  James Scholes
  http://twitter.com/JamesScholes
  ----------------------------------------------------------------
  NVDA add-ons: A list to discuss add-on code enhancements and for reporting 
bugs.

  Community addons are available from: http://addons.nvda-project.org
  To send a message to the list: nvda-addons@xxxxxxxxxxxxx
  To change your list settings/unsubscribe: 
//www.freelists.org/list/nvda-addons
  To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx 
  ----------------------------------------------------------------
  NVDA add-ons: A list to discuss add-on code enhancements and for reporting 
bugs. 
  Community addons are available from: http://addons.nvda-project.org
  To send a message to the list: nvda-addons@xxxxxxxxxxxxx
  To change your list settings/unsubscribe: 
//www.freelists.org/list/nvda-addons
  To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: