Re: Fruit basket program in Boo

  • From: "rrdinger" <rrdinger@xxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 21 Oct 2007 08:34:52 -0700

Just a quick point Teddy. You may not recall, but jaws will tell you what indentation level if you do a SayLine command. That may help you if you can't remenber what indentation level you are at. ----- Original Message ----- From: "Octavian Rasnita" <orasnita@xxxxxxxxx>

To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, October 21, 2007 8:01 AM
Subject: Re: Fruit basket program in Boo


I know that even Jaws allows us to set it to warn us when the indentation changes, but I never liked that way of working. That's because I don't remember the indentation levels, so I never use indentation. When I was sighted I considered a program code a bad code by default if I saw that it doesn't use indentation. But now I don't find it useful.

I am so used to (not) hear the (){} and the quotes that sometimes when I want to be sure that a certain line really contains quotes or some other chars, I need to read it char by char, because I almost don't hear Jaws saying "quote" or "left param", "right param", so it is not a problem for me.

I like to hear the punctuation signs, because then I know that everything's all right. That's why I never like to put the first { after a subroutine definition on the next line after the subroutine signature. It might be friendlier for the sighted to put it that way, because some programmers might use indentation and it might align with the ending }, however I don't need indentation, so the code would become bigger with a line, with no benefit.

I don't need { and } just for jumping from the start of a block to its end, but to select the content of that block also, for pasting it into another place in the program source.

I also need them because that way I can detect if I wrote a correct code. For example, if I see that the start { doesn't match with the ending }, it generally means that something was not correct, and the match will be usually with a { or } which would another pair { or } and this way would be easier to detect where I've made the mistake.

(This is important in a perl program where I use many hash elements wrote with { and }. In other languages it might be not so important).

Octavian

----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, October 21, 2007 4:50 PM
Subject: Re: Fruit basket program in Boo


I realize you are expressing your own opinion.  Mine is different.  I
find both advantages and disadvantages.  Braces do have the advantage of
easier navigation by matching a brace that starts or ends a block of
code.  The lack of braces, parentheses, and semicolons, on the other
hand, makes the code cleaner, less verbose with speech, easier to read,
and less prone to common syntax errors of forgetting to include a
punctuation mark in code that is otherwise correct syntax.

I know you prefer TextPad, but let me make sure others are aware that
TextPal and EdSharp include several commands that help manage
indentation in speech friendly ways.

Jamal
On Sun, 21 Oct 2007, Octavian Rasnita
wrote:

Date: Sun, 21 Oct 2007 15:51:42 +0300
From: Octavian Rasnita <orasnita@xxxxxxxxx>
Reply-To: programmingblind@xxxxxxxxxxxxx
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Fruit basket program in Boo

Yes, the fact that it can be used as a scripting language is an advantage. But the fact that it doesn't use { and } to include blocks, and ; to end the
statements, it is a big disadvantage.

Just like python, it is friendlier for sure for sighted users, but not for
the blind.

Octavian

----- Original Message -----
From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, October 21, 2007 3:11 PM
Subject: Re: Fruit basket program in Boo


> Boo does have the indentation issue of Python.  The language is
> considerably more concise and friendly than C#, however. This > probably
> does not show in the example I posted because I used an automatic
> converter from C# that did a more or less literal translation rather > than > taking advantage of Boo idioms. I will try to write a more Booish > version
> when I get a chance (or anyone else can feel free to do so).
>
> Besides more convenient syntax (except for the indentation > requirement),
> Boo has the advantage of an interpretive mode over C#.  Thus, one can
> test expressions in an interactive environment.  When the code is
> refined, one can still compile to a stand-alone executable like C#.
>
> Jamal
> On Sat,
> 20 Oct 2007, Octavian Rasnita wrote:
>
>> Date: Sat, 20 Oct 2007 09:39:08 +0300
>> From: Octavian Rasnita <orasnita@xxxxxxxxx>
>> Reply-To: programmingblind@xxxxxxxxxxxxx
>> To: programmingblind@xxxxxxxxxxxxx
>> Subject: Re: Fruit basket program in Boo
>>
>> Well, I'd say that this language also borrows the disadvantages of >> python
>> and the disadvantages of C#.
>>
>> It is harder to use by a blind because of its python style without
>> punctuation signs, it requires same much code as C#, and it is not
>> portable.
>>
>> If Windows need to be the target platform, I think C# is much better >> for
>> creating such a program.
>>
>> Octavian
>>
>> ----- Original Message -----
>> From: "Jamal Mazrui" <empower@xxxxxxxxx>
>> To: <programmingblind@xxxxxxxxxxxxx>
>> Sent: Saturday, October 20, 2007 6:22 AM
>> Subject: Fruit basket program in Boo
>>
>>
>> > From the zip archive at
>> > http://www.EmpowermentZone.com/boo_fruit.zip
>> >
>> > This fruit basket program is written in Boo -- Full source code in >> > the >> > zip archive and pasted below. The batch file compile.bat invokes >> > the
>> > command-line compiler for this scripting language.  The resulting
>> > executable, boo_fruit.exe, is about 12K in size. No other files >> > are
>> > needed to run the program -- as long as the .NET Framework 2.0 is
>> > installed.
>> >
>> > Boo borrows syntax from Python, seeks to improve it, and combine
>> > strengths
>> > of both static and dynamic languages.  Its home page is at
>> > http://boo.codehaus.org
>> > Boo resources, including the interpreter, compiler, documentation, >> > and
>> > examples are available from there.
>> >
>> > I am still learning Boo, but was able to produce a working program >> > by
>> > converting the first C# fruit basket program I did via a web form
>> > available at
>> > http://codeconverter.sharpdevelop.net/Convert.aspx
>> > For comparison, the C# code is available in the file cs_fruit.cs.
>> >
>> > Jamal
>> >
>> > /*
>> > content of boo_fruit.boo
>> > Fruit Basket program in Boo
>> > Public domain by Jamal Mazrui
>> > */
>> >
>> > namespace MyNamespace
>> >
>> > import System.Windows.Forms
>> >
>> > // define class inherited from Form
>> > public class MyForm(System.Windows.Forms.Form):
>> >
>> > private lblFruit as Label
>> >
>> > private txtFruit as TextBox
>> >
>> > private lblBasket as Label
>> >
>> > private lbBasket as ListBox
>> >
>> > private btnAdd as Button
>> >
>> > private btnDelete as Button
>> >
>> >
>> > public def constructor():
>> > // define constructor
>> > // set window title
>> > self.Text = 'Fruit Basket'
>> > //this.Width = 328;
>> > self.Width = 400
>> > self.Height = 285
>> >
>> > // create two rows of controls with three controls in each
>> > row
>> > // label, textbox, button and label, listbox, button
>> > lblFruit = Label()
>> > lblFruit.Text = '&Fruit:'
>> > lblFruit.Left = 14
>> > lblFruit.Top = 14
>> > lblFruit.Width = 44
>> > lblFruit.Height = 16
>> >
>> > txtFruit = TextBox()
>> > txtFruit.Left = 64
>> > txtFruit.Top = 14
>> > txtFruit.Width = 200
>> > txtFruit.Height = 16
>> >
>> > btnAdd = Button()
>> > btnAdd.Text = '&Add'
>> > btnAdd.Left = 272
>> > btnAdd.Top = 14
>> > btnAdd.Width = 100
>> > btnAdd.Height = 20
>> > //  make it the default button
>> > self.AcceptButton = btnAdd
>> > btnAdd.Click += self.OnAddClick
>> >
>> > lblBasket = Label()
>> > lblBasket.Text = '&Basket:'
>> > lblBasket.Left = 14
>> > lblBasket.Top = 38
>> > lblBasket.Width = 44
>> > lblBasket.Height = 16
>> >
>> > lbBasket = ListBox()
>> > lbBasket.Left = 64
>> > lbBasket.Top = 38
>> > lbBasket.Width = 200
>> > lbBasket.Height = 200
>> >
>> > btnDelete = Button()
>> > btnDelete.Text = '&Delete'
>> > btnDelete.Left = 272
>> > btnDelete.Top = 38
>> > btnDelete.Width = 100
>> > btnDelete.Height = 20
>> > btnDelete.Click += self.OnDeleteClick
>> >
>> > // add controls to form
>> > self.Controls.Add(lblFruit)
>> > self.Controls.Add(txtFruit)
>> > self.Controls.Add(btnAdd)
>> > self.Controls.Add(lblBasket)
>> > self.Controls.Add(lbBasket)
>> > self.Controls.Add(btnDelete)
>> >
>> > // center form on screen
>> > self.StartPosition = FormStartPosition.CenterScreen
>> >
>> >
>> > // define event handlers for add and delete buttons
>> > protected def OnAddClick(sender as object, e as System.EventArgs):
>> > sFruit as string
>> > sFruit = txtFruit.Text
>> > if sFruit == '':
>> > MessageBox.Show('No fruit to add.', 'Alert')
>> > else:
>> > lbBasket.Items.Add(sFruit)
>> > txtFruit.Text = ''
>> > lbBasket.SelectedIndex = (lbBasket.Items.Count -
>> > 1)
>> > txtFruit.Focus()
>> >
>> >
>> > protected def OnDeleteClick(sender as object, e as
>> > System.EventArgs):
>> > iFruit as int
>> > iFruit = lbBasket.SelectedIndex
>> > if iFruit == (-1):
>> > MessageBox.Show('No fruit to delete.', 'Alert')
>> > else:
>> > lbBasket.Items.RemoveAt(iFruit)
>> > if iFruit > (lbBasket.Items.Count - 1):
>> > iFruit = (lbBasket.Items.Count - 1)
>> > lbBasket.SelectedIndex = iFruit
>> > lbBasket.Focus()
>> >
>> >
>> > // define main entry point of application
>> > public static def Main():
>> > Application.Run(MyForm())
>> >
>> > MyForm.Main()
>> >
>> > //End of program
>> >
>> > __________
>> > View the list's information and change your settings at
>> > //www.freelists.org/list/programmingblind
>> >
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

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

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


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



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

Other related posts: