How to Program/en: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
Zeile 31: Zeile 31:




Now do the same, but apply the "''inspectIt''" menu function; an inspector will appear, which shows the result (another string, containing the first 5 characters:
Now do the same, but apply the "''inspectIt''" menu function; an inspector will appear, which shows the result (another string, containing the first 5 characters):


[[Datei:inspector_tool.png]]
[[Datei:inspector_tool.png]]

The inspector shows some meta-info (class and size) plus the internal slots of the object on the left,
and displays the selected slot's value in the right subview, which is another workspace (so "''doIt''" is again possible there). Double-click on a left entry navigates into it.

Version vom 21. Dezember 2016, 09:48 Uhr

Introduction to Programming in expecco[Bearbeiten]

Before you start programming, please read this document, which describes how program code is handled in expecco. Unless you are familiar with the dynamics of a Smalltalk development environment, some of it may be unknown to you. You will have more fun and be more productive, if you know the power of the tools.

Executing Code Fragments[Bearbeiten]

Most of the tools inside expecco (especially the editor, notepad, data inspector and debugger) are able to execute code fragments.

To do this, select the piece of code to be executed and choose one of the "doIt", "printIt" or "inspectIt" menu functions. If no text is selected, the full cursor text line is evaluated. The ESC-key selects everything from the start of the line up to the current cursor position.

"DoIt" will simply execute the code, "printIt" will paste the returned value and "inspectIt" will open a data inspector on the result. The syntax depends on the context: in a workspace, it is selectable via a menu setting, in a debugger, it will be the language of the function being shown, in an inspector it is usually Smalltalk syntax. To get a feeling for this, try the following:

  • open a workspace (Mainmenu: "Extras" -> "Tools" -> "Notepad")
  • select Smalltalk syntax (Workspacemenu: "Workspace" -> "Smalltalk")
  • enter a piece of Smalltalk code (for example: "1024 hexPrintString")
  • select this code
  • apply "PrintIt"
  • the text "400" (which is the hexadecimal representation of the integer 1024) will be pasted at the text cursor position.

Try the same with the code fragment: " 'hello world' copyTo: 5 ".

Opening a notepad (workspace):

Opening workspace.png

Evaluating a code fragment:

Workspace printit.png


Now do the same, but apply the "inspectIt" menu function; an inspector will appear, which shows the result (another string, containing the first 5 characters):

Inspector tool.png

The inspector shows some meta-info (class and size) plus the internal slots of the object on the left, and displays the selected slot's value in the right subview, which is another workspace (so "doIt" is again possible there). Double-click on a left entry navigates into it.



Copyright © 2014-2024 eXept Software AG