SlideShare une entreprise Scribd logo
1  sur  15
Collections, Arrays & Iteration

          Mike Feltman
         F1 Technologies
Agenda
   Collections in VFP
   Working with Collections
   Writing Better Code with Collections
   Using Collections for Object Manipulation
   Adding Power to VFP Arrays
   Collections vs. Arrays
   Merging Arrays & Collections
Who Am I
   President F1 Technologies since 1990
   Co-author Visual FoxExpress
   Consultant
   Xbase Developer since dBase III/FoxBase
    1987
“Objects” Collections in VFP
   _SCREEN, _VFP, FormSet,
    DataEnvironment, Toolbar, Container,
    PageFrame, Page, Grid, Column,
    CommandGroup, OptionGroup, Container,
    Custom, Control
Other Collections in VFP
   _VFP
       Forms
       Projects
   Project
       Files
       Servers
   XMLAdapter
       Tables
   XMLTable
       Fields
“Pseudo” Collections in VFP
   _SCREEN.Controls        _SCREEN.Forms
   Form.Controls           FormSet.Forms
   Custom.Controls         CommandGroup.Buttons
   Control.Controls        OptionGroup.Buttons
   Toolbar.Controls        PageFrame.Pages
   Container.Controls      Grid.Columns
   Column.Controls
The Collection Class
   New in VFP 8
   Key Properties
       Count
       KeySort (0-3)
   Key Methods
       Add(eItem, cKey, eBefore, eAfter)
       Item(eIndex)
       GetKey(eIndex)
Iterating Collections
   FOR lnI = 1 TO loCollection.Count
   FOR EACH loObject in loCollection
   FOR EACH loObject in loCollection
    FOXOBJECT

   Examples: Iterate1.prg, Iterate2.prg,
    Iterate3.prg
UI Support for Collections
   Listbox
   ComboBox

   Example: CollectionDemo.SCX
Writing Better Code with
               Collections
   Problem: This.Parent.Page2.txtCompany
    creates a tightly coupled dependency.
   Solution: Dynamically retrieved Object
    references eliminate tight coupling.
   o=o(…) or o=f(…)
Using Collections for Multiple
         Object Manipulations
   AC
   CC
   WC
Returning an Array
   From within a class method a member
    array can be used as the return value.
   A function can return an array by calling a
    class method that returns an array.

   Example: aConcact in utility.prg
Array Utilities
   aCompact
   aConcat
   aFirst
   aJoin
   aLast
   aReverse
   aUnique
   aWithout
   ArrayDemo.Prg
Wrapping an Array in a Collection
   Fox Data Objects – ADO / LINQ like
   DataCollection.prg, cDataCollection of
    cData
Conclusion
   Collections in VFP provide convenient ways to
    access objects
   Retrieving object references from collections can
    make code a lot more flexible and stable
   VFP has a lot of powerful options available on
    arrays
   Collection and array implementations are just
    different enough that each has their own place.

Contenu connexe

Tendances

Python NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaPython NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaEdureka!
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Anand Ingle
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturergomathi chlm
 
Presentation on Heap Sort
Presentation on Heap Sort Presentation on Heap Sort
Presentation on Heap Sort Amit Kundu
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologiesPolad Saruxanov
 
Ronalao termpresent
Ronalao termpresentRonalao termpresent
Ronalao termpresentElma Belitz
 
Ds
DsDs
DsAcad
 
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce Fabio Fumarola
 
Frequent Itemset Mining(FIM) on BigData
Frequent Itemset Mining(FIM) on BigDataFrequent Itemset Mining(FIM) on BigData
Frequent Itemset Mining(FIM) on BigDataRaju Gupta
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPyDevashish Kumar
 
Heap Data Structure
 Heap Data Structure Heap Data Structure
Heap Data StructureSaumya Som
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structureSajid Marwat
 
Dynamic Memory Allocation
Dynamic Memory AllocationDynamic Memory Allocation
Dynamic Memory Allocationvaani pathak
 

Tendances (20)

Python NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaPython NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | Edureka
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
 
Presentation on Heap Sort
Presentation on Heap Sort Presentation on Heap Sort
Presentation on Heap Sort
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologies
 
Data Analysis packages
Data Analysis packagesData Analysis packages
Data Analysis packages
 
Lecture1 classes4
Lecture1 classes4Lecture1 classes4
Lecture1 classes4
 
Ronalao termpresent
Ronalao termpresentRonalao termpresent
Ronalao termpresent
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Ds
DsDs
Ds
 
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
 
Frequent Itemset Mining(FIM) on BigData
Frequent Itemset Mining(FIM) on BigDataFrequent Itemset Mining(FIM) on BigData
Frequent Itemset Mining(FIM) on BigData
 
Apriori algorithm
Apriori algorithmApriori algorithm
Apriori algorithm
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPy
 
Heap Data Structure
 Heap Data Structure Heap Data Structure
Heap Data Structure
 
Plotting data with python and pylab
Plotting data with python and pylabPlotting data with python and pylab
Plotting data with python and pylab
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structure
 
Python for lab_folk
Python for lab_folkPython for lab_folk
Python for lab_folk
 
Review functions
Review functionsReview functions
Review functions
 
Dynamic Memory Allocation
Dynamic Memory AllocationDynamic Memory Allocation
Dynamic Memory Allocation
 

En vedette

Html for desktop applications
Html for desktop applicationsHtml for desktop applications
Html for desktop applicationsMike Feltman
 
Introduction to afp
Introduction to afpIntroduction to afp
Introduction to afpMike Feltman
 
Where do you want to go today 2007
Where do you want to go today   2007Where do you want to go today   2007
Where do you want to go today 2007Mike Feltman
 
Where do you want to go today
Where do you want to go todayWhere do you want to go today
Where do you want to go todayMike Feltman
 
What’s new in x case 8
What’s new in x case 8What’s new in x case 8
What’s new in x case 8Mike Feltman
 
Html and visual fox pro
Html and visual fox proHtml and visual fox pro
Html and visual fox proMike Feltman
 
N tier web applications
N tier web applicationsN tier web applications
N tier web applicationsMike Feltman
 
Docking from a z in visual fox pro 9
Docking from a z in visual fox pro 9Docking from a z in visual fox pro 9
Docking from a z in visual fox pro 9Mike Feltman
 
Error handling in visual fox pro 9
Error handling in visual fox pro 9Error handling in visual fox pro 9
Error handling in visual fox pro 9Mike Feltman
 

En vedette (12)

Html for desktop applications
Html for desktop applicationsHtml for desktop applications
Html for desktop applications
 
Drop acid
Drop acidDrop acid
Drop acid
 
Feltman js4 vfp
Feltman js4 vfpFeltman js4 vfp
Feltman js4 vfp
 
Introduction to afp
Introduction to afpIntroduction to afp
Introduction to afp
 
Where do you want to go today 2007
Where do you want to go today   2007Where do you want to go today   2007
Where do you want to go today 2007
 
Where do you want to go today
Where do you want to go todayWhere do you want to go today
Where do you want to go today
 
What’s new in x case 8
What’s new in x case 8What’s new in x case 8
What’s new in x case 8
 
VFP & Ajax
VFP & AjaxVFP & Ajax
VFP & Ajax
 
Html and visual fox pro
Html and visual fox proHtml and visual fox pro
Html and visual fox pro
 
N tier web applications
N tier web applicationsN tier web applications
N tier web applications
 
Docking from a z in visual fox pro 9
Docking from a z in visual fox pro 9Docking from a z in visual fox pro 9
Docking from a z in visual fox pro 9
 
Error handling in visual fox pro 9
Error handling in visual fox pro 9Error handling in visual fox pro 9
Error handling in visual fox pro 9
 

Similaire à Feltman collections

C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1ReKruiTIn.com
 
Net framework session02
Net framework session02Net framework session02
Net framework session02Vivek chan
 
‘go-to’ general-purpose sequential collections - from Java To Scala
‘go-to’ general-purpose sequential collections -from Java To Scala‘go-to’ general-purpose sequential collections -from Java To Scala
‘go-to’ general-purpose sequential collections - from Java To ScalaPhilip Schwarz
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5Mahmoud Ouf
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworksMD Sayem Ahmed
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic classifis
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .NetGreg Sohl
 
Development of forms editors based on Ecore metamodels
Development of forms editors based on Ecore metamodelsDevelopment of forms editors based on Ecore metamodels
Development of forms editors based on Ecore metamodelsMario Cervera
 
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19Max Kleiner
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
C basic questions&ansrs by shiva kumar kella
C basic questions&ansrs by shiva kumar kellaC basic questions&ansrs by shiva kumar kella
C basic questions&ansrs by shiva kumar kellaManoj Kumar kothagulla
 

Similaire à Feltman collections (20)

C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
Net framework session02
Net framework session02Net framework session02
Net framework session02
 
Intake 37 ef2
Intake 37 ef2Intake 37 ef2
Intake 37 ef2
 
EnScript Workshop
EnScript WorkshopEnScript Workshop
EnScript Workshop
 
Java Collections Tutorials
Java Collections TutorialsJava Collections Tutorials
Java Collections Tutorials
 
‘go-to’ general-purpose sequential collections - from Java To Scala
‘go-to’ general-purpose sequential collections -from Java To Scala‘go-to’ general-purpose sequential collections -from Java To Scala
‘go-to’ general-purpose sequential collections - from Java To Scala
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworks
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic class
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
Development of forms editors based on Ecore metamodels
Development of forms editors based on Ecore metamodelsDevelopment of forms editors based on Ecore metamodels
Development of forms editors based on Ecore metamodels
 
C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
 
Java mcq
Java mcqJava mcq
Java mcq
 
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19
 
Design patterns
Design patternsDesign patterns
Design patterns
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
C basic questions&ansrs by shiva kumar kella
C basic questions&ansrs by shiva kumar kellaC basic questions&ansrs by shiva kumar kella
C basic questions&ansrs by shiva kumar kella
 

Feltman collections

  • 1. Collections, Arrays & Iteration Mike Feltman F1 Technologies
  • 2. Agenda  Collections in VFP  Working with Collections  Writing Better Code with Collections  Using Collections for Object Manipulation  Adding Power to VFP Arrays  Collections vs. Arrays  Merging Arrays & Collections
  • 3. Who Am I  President F1 Technologies since 1990  Co-author Visual FoxExpress  Consultant  Xbase Developer since dBase III/FoxBase 1987
  • 4. “Objects” Collections in VFP  _SCREEN, _VFP, FormSet, DataEnvironment, Toolbar, Container, PageFrame, Page, Grid, Column, CommandGroup, OptionGroup, Container, Custom, Control
  • 5. Other Collections in VFP  _VFP  Forms  Projects  Project  Files  Servers  XMLAdapter  Tables  XMLTable  Fields
  • 6. “Pseudo” Collections in VFP  _SCREEN.Controls  _SCREEN.Forms  Form.Controls  FormSet.Forms  Custom.Controls  CommandGroup.Buttons  Control.Controls  OptionGroup.Buttons  Toolbar.Controls  PageFrame.Pages  Container.Controls  Grid.Columns  Column.Controls
  • 7. The Collection Class  New in VFP 8  Key Properties  Count  KeySort (0-3)  Key Methods  Add(eItem, cKey, eBefore, eAfter)  Item(eIndex)  GetKey(eIndex)
  • 8. Iterating Collections  FOR lnI = 1 TO loCollection.Count  FOR EACH loObject in loCollection  FOR EACH loObject in loCollection FOXOBJECT  Examples: Iterate1.prg, Iterate2.prg, Iterate3.prg
  • 9. UI Support for Collections  Listbox  ComboBox  Example: CollectionDemo.SCX
  • 10. Writing Better Code with Collections  Problem: This.Parent.Page2.txtCompany creates a tightly coupled dependency.  Solution: Dynamically retrieved Object references eliminate tight coupling.  o=o(…) or o=f(…)
  • 11. Using Collections for Multiple Object Manipulations  AC  CC  WC
  • 12. Returning an Array  From within a class method a member array can be used as the return value.  A function can return an array by calling a class method that returns an array.  Example: aConcact in utility.prg
  • 13. Array Utilities  aCompact  aConcat  aFirst  aJoin  aLast  aReverse  aUnique  aWithout  ArrayDemo.Prg
  • 14. Wrapping an Array in a Collection  Fox Data Objects – ADO / LINQ like  DataCollection.prg, cDataCollection of cData
  • 15. Conclusion  Collections in VFP provide convenient ways to access objects  Retrieving object references from collections can make code a lot more flexible and stable  VFP has a lot of powerful options available on arrays  Collection and array implementations are just different enough that each has their own place.