42
EXTREME SQR PROGRAMMING (Successful projects tend to be architecture driven). John Willson http://www.dssltd.com

EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

  • Upload
    ngodan

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

EXTREME SQR PROGRAMMING

(Successful projects tend to be architecture driven).

John Willson

http://www.dssltd.com

Page 2: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 2

Goal: To describe the world in loosely coupled,highly cohesive SQR program units.

•Organizational goals influence requirements (or gaps)•Requirements lead to architecture•Architectures yield systems•Systems suggest evolution of organizationalcapabilities and requirements [Bass98]

Page 3: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 3

Client Expectations andResources

[Willson98]

Page 4: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 4

Client Expectations andResources Meeting

[Willson98]

Page 5: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 5

Client Expectations andResources Profit

[Willson98]

Page 6: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 6

Client Expectations andResources Loss

[Willson98]

Page 7: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 7

SQR Language Review Program Flow

Declare Includes

Begin-Report! Begin-Program

do MAIN

Begin-ProcedureMAIN

do SUB_PROC

Begin-ProcedureSUB_PROC

do ANOTHER_SUB

Begin-ProcedureANOTHER_SUB

! do MANY_MORE

Declare MoreIncludes

FIGURE 1. SQRProgram StructureOUT OF THE BOX

Blockof Globals&Defines

Begin-Heading

Begin-Footing

Begin-Setup Begin-Select

Begin-SQL

Others

Legendprocedural calls

external program calls

optional procedures

Page 8: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 8

SQR Language Review DataStructures

FIGURE 2. SQRData elements andData Structures

SQR Data Elements

SQL Column data types

String Literalsand Reserved Words

Document EmbeddedCharacters

SQR Variables Large Decimal Numbers

Floating Numbers

Integers

Dates

SQR Variables

Dates, Images, LongStrings

Static Array basedData Structures

Page 9: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 9

Current Software ArchitectureDesign Batch Sequential

FIGURE 3. BatchSequential Design

Validate InputProcessing

and/orSelect

Output

ValidateInputProcessingOutput ValidateInputProcessingOutput ValidateInputProcessingOutputValidateInputProcessingOutput

Page 10: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 10

Example Software ArchitectureDesign Scenario 1

• Billing application with bill (a.k.a. SQRdocument in PS) with number of intermixedlandscape, portrait, and seascape pages

• Bill handled multiple media and includedpostal sorting, stuffing bar codes

• Billing application was a component in alarger system; however, application waswritten from scratch using the batchsequential design pattern

Page 11: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 11

Current Software Architecture DesignMain Program/Sub Procedures

FIGURE 4. Mainprogramsub procedure design

ValidateInputProcessingOutput

ValidateInputProcessingOutput

ValidateInputProcessingOutput ValidateInputProcessingOutput

ValidateInputProcessingOutput

ValidateInputProcessingOutputValidateInputProcessingOutput

ValidateInputProcessingOutput

ValidateInputProcessingOutput

Page 12: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 12

Example Software ArchitectureDesign Scenario 2

• ERP application where there is already abuilt up collection of SQRs and includes

• Development issues include education andtraining on standards and include collections

• Waterfall methodology is followed withemphasis on documentation, sign off, andintegration testing

• Scalability is achieved by doing samemicro designs again and again until macrotask is completed

Page 13: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 13

Old Cost to Change and CurrentSQR Development Life Cycle

Gaps/Reqs Functional Technical Code Test Implement Production

Page 14: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 14

Object-Oriented SoftwareArchitecture Design with SQR

FIGURE 5. ObjectOriented Programmingin SQR

Stack.inc

Array of Integer ElementsDepth of stack

Create stackStack EmptyPush on stackPop off stack

Base10.sqr

NumberRemainder

Begin ReportBegin SetupGet Number Base 10Print Number Base 2Input NumberCalculate Remainder

Page 15: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 15

Example OO SQR Program#include 'stack.inc'

begin-setupdeclare-variableinteger #number #remainder

end-declareend-setup

begin-reportdo get_number_base10do create_stackdo print_base2

end-report

begin-procedure get_number_base10show 'Base 10 to base 2 Number Converter'input $numbase10 'Enter base 10 number(max 4 digits) ' type=integer maxlen=4end-procedure

begin-procedure print_base2show ' Number in Base 10 = ' $numbase10move $numbase10 to #numberwhile #number <> 0let #remainder = mod(#number, 2)do stack_push(#remainder,#depth)let #number = trunc(#number/2,0)

end-whiledisplay ' Number in Base 2 = ' nolinedo stack_empty(#depth, #stack_empty)while not #stack_empty = 1do stack_pop(#remainder, #depth)display #remainder nolinedo stack_empty(#depth, #stack_empty)

end-whileend-procedure

begin-procedure create_stack#define MAX_ROWS 1000create-array name=stack size={MAX_ROWS}

field=j:number! #depth - Stack depthlet #depth = 1

end-procedure

begin-procedure stack_empty(#depth, :#stack_empty)if #depth = 0

let #stack_empty = 1else

let #stack_empty = 0end-if

end-procedure

begin-procedure stack_push (#push, :#depth)let stack.j(#depth) = #pushlet #depth = #depth + 1

end-procedure

begin-procedure stack_pop (:#pop, :#depth)let #pop = stack.j(#depth)let #depth = #depth - 1

end-procedure

Page 16: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 16

Example OO SQR Program BlockStructure#include 'stack.inc'

begin-setupdeclare-variableinteger #number #remainder

end-declareend-setup

begin-reportdo get_number_base10do create_stackdo print_base2

end-report

begin-procedure get_number_base10show 'Base 10 to base 2 Number Converter'input $numbase10 'Enter base 10 number(max 4 digits) ' type=integer maxlen=4end-procedure

begin-procedure print_base2show ' Number in Base 10 = ' $numbase10move $numbase10 to #numberwhile #number <> 0let #remainder = mod(#number, 2)do stack_push(#remainder,#depth)let #number = trunc(#number/2,0)

end-whiledisplay ' Number in Base 2 = ' nolinedo stack_empty(#depth, #stack_empty)while not #stack_empty = 1do stack_pop(#remainder, #depth)display #remainder nolinedo stack_empty(#depth, #stack_empty)

end-whileend-procedure

begin-procedure create_stack#define MAX_ROWS 1000create-array name=stack size={MAX_ROWS}

field=j:number! #depth - Stack depthlet #depth = 1

end-procedure

begin-procedure stack_empty(#depth, :#stack_empty)if #depth = 0

let #stack_empty = 1else

let #stack_empty = 0end-if

end-procedure

begin-procedure stack_push (#push, :#depth)let stack.j(#depth) = #pushlet #depth = #depth + 1

end-procedure

begin-procedure stack_pop (:#pop, :#depth)let #pop = stack.j(#depth)let #depth = #depth - 1

end-procedure

Page 17: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 17

OO/UML Modeling a System’sArchitecture

[Booch99] page 31

Page 18: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 18

OO Software Architecture DesignScenario NULL

• Rumored rejected

• Binding time

• Language pointers

• Going against the metaphor

• Classes

• Language extensions using UFUNC, UCALL

• and More

Page 19: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 19

Another Software ArchitectureDesign with SQR

FIGURE 7. Current Intermediateto Large System DevelopmentSpiral versus Waterfall

Objectives,alternatives,constraints

Risks

PlansDevelopment, nextlevel product

Prototype 3

Prototype 2

Prototype 1

Requirements,SDLC Plan

Concept ofOperation

Review

Development plan

Integration & test plan

Page 20: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 20

Spiral Software ArchitectureDesign Scenario NULL

• Likely tried (see projects that use the word‘prototype’)

• Frequency of prototypes

• Emphasis of risk, planning and revisiting

• Continues to some extent waterfall model ‘strategy,analyze, design, develop, text, deploy’

Page 21: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 21

Current SQR DevelopmentSummary

New System Development

• repeatedly apply batch sequential design

• repeatedly apply main program and sub proceduredesign

Legacy/ERP System Development

• complete collection of includes and/or SQRs

• follow standards (Gaps, Functional, Technical,Unit Testing, Signoffs, Naming)

Page 22: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 22

Generic N-tier Non-SQRDevelopment

[Hoover00]

Page 23: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 23

Example Software ArchitectureDesign Scenario 3

• See [Miller99] for a Report Suite methodology

• This methodology contains many includes

that predispose the software architecture tothe micro build approach

• Software developers work alone in silo’s ofthe application domain

• Methodology emphasis is incremental anditerative design change

• SDLC component emphasis need based

Page 24: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 24

EXTREME SQR PROGRAMMING

[Wells00]

Page 25: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 25

Extreme Programming Practices

• The planning game

• Small releases

• Metaphor

• Simple design

• Testing

• Refactoring[Beck00]

Page 26: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 26

Extreme Programming PracticesContinued

• Pair programming

• Collective ownership

• 40-hour week

• On-site customer

• Coding Standards

Page 27: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 27

Extreme Programming Trade-offs

• Extreme Programming versus a ‘Death March’

• Extreme Programming versus ‘lazy or poor softwareengineering practice’

• Extreme Programming versus ‘the water fall orcascade life cycle’

• XP is early, concrete, continuous feedback, testedsoftware

• XP is incremental, evolutionary, collaborative,proven, conservative programming practice

Page 28: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 28

Example Software ArchitectureDesign Scenario 4(1)

Scalability Project size included multi site/multi national development and

client/contractor teams

Project delivery date remained fixed through out the project andwas met (elapsed time of 4 months from start of development)

Project complexity grew

Methodology and design metaphor matched changing userstories (the spread sheet metaphor of a page was used tocapture the changing user stories.)

New technology of a star database design was used in place ofthe third normal form relational database model.

Page 29: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 29

Example Software ArchitectureDesign Scenario 4(2)

Metaphor

Spread Sheet Cell c/w attributes

.

NumberDollar TypeTime TypeCurrency TypeUnit of measure

Report typeReport IdRow DescriptionTotaling

Column X Cell

Row Y

Page 30: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 30

Example Software ArchitectureDesign Scenario 4(3)

Team Organization Team members worked in paired

contractor cubicles and withpaired client/contractor teammembers (approximately 10contractors and 22 clientdevelopers were buddies)

Team members worked inapplication domain silos

Work breakdown structureincluded report assignment perteam member and includedevelopment

Page 31: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 31

Example Software ArchitectureDesign Scenario 4(4)

Design Design was incremental and iterative with changing design occurring

as user stories changed. (pre and post lunch requirement changes)

There was continuous integration of includes with SQR reports

The design included world wide deployment through the net and aproprietary software component called the Brio Portal

Team Organization (Continued)

Work assignments were driven by deadlines to be met and notby person hour estimates There was collective code ownership with all includes and SQRsbeing published and visible to all team members

Page 32: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 32

Example Software ArchitectureDesign Scenario 4(5)

Physical View

IE 4Netscape 4 Opera 3

•Brio.Report 6•Oracle 8•Star database•Brio.Portal 7•Unix (Bourne)•WinNT

ImportSAP®

Page 33: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 33

Example Software ArchitectureDesign Scenario 4(6)

Testing There was continuous integration and testing of changing user

requirements

There was strong acceptance testing of published unit testedSQR reports with the acceptance testing becoming a major highlevel activity

Customer Satisfaction There were a large number of versions, with multiple feature

capabilities, and with a common end-user look and feel

The number of bugs were quite low considering the scope of theproject and the timeframe

The system is in use now.

Page 34: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 34

Client Expectations andResources Revisited

Page 35: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 35

New Cost to Change and X SQR PDevelopment Life Cycle

Release Release Release Release

Page 36: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 36

Summary

• Extreme SQR programming can work even thoughSQR is procedural and not object oriented

• Benefits of early releases, improved clientsatisfaction, continuous testing, and developersatisfaction worth the effort to try it

• Return on software investment can be verified witheach release!

Page 37: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 37

Q & A

• ?

• ?

• ?

Page 38: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 38

References/URLs Used in XSP• [Bass98] Software Architecture in Practice,

Len Bass, Paul Clements, Rick Kazman. Addison WesleyLongman, 1998, ISBN 0-201-19930-0.

• [Beck00] Extreme Programming Explained, Kent Beck,Addison Wesley, 2000, ISBN 201-61641-6

• [Booch99] The Unified Modelling Language User Guide,Grady Booch, James Rumbaugh, & Ivar Jacobson.Addison Wesley Longman, 1999, ISBN 0-201-57168-4.

• [Hoover00] Object-Oriented Analysis and Design,H. Jim Hoover, Tony Olekshy, Avra Software Lab Inc.2000 http://www.avrasoft.com

• [Landres99] SQR in PeopleSoft and Other Applications,Galinda Landres and Vlad Landres, Manning Publications,Greenwich, CT, USA December 1999, ISBN 1-884777-77-5 URL: http://www.manning.com

• [Martin00] ‘Design Principles and Design Patterns’,Robert C. Martin, ObjectMentor, 2000

URL:http://www.objectmentor.com

• [Miller99] A Development Methodology for EnterpriseReporting, Darrin Miller, Insight 2000, Brio TechnologySecond Annual Worldwide User Conference, Monterey,CA, USA, May 2000. URL: http://www.brio.com

• [Parnas85] The Modular Structure of Complex Systems’,David L. Parnas, C. Clements, and David M. Weiss. IEEETransactions on Software Engineering SE-11(3): 259-266,1985

• [PS97] ] SQL/SQR for PeopleSoft’, PeopleSoft, WalnutCreek, CA, USA, January, 1997 URL:http://www.peoplesoft.com

• [Ontko00] SQR Programmer Reference, Don Mellen, RayOntko & Co., 2000, ISBN: 0-9677730-0-8 URL:

http://www.ontko.com

• [Shaw96] Comparing Architectural Design Styles’, MaryShow, IEEE Software November 1995[Wells00] ExtremeProgramming: A gentle Introduction, J. Donovon Wells,2000, http://extremeprogramming.org/

• [Tjen00] Designing a Framework for Developing Web-Enabled Analytic Applications’, David Tjen, Insight 2000,Brio Technology Second Annual Worldwide UserConference, Monterey, CA, USA, May 2000.

• [Wells00] Extreme Programming: A gentle Introduction, J.Donovon Wells, 2000, http://extremeprogramming.org/

• [Willson98] U.S.A. Computer Consulting (for Canadiansand other Aliens), John Willson, Stephanie Crafford, DSSLtd. 1998, ISBN 0-9683657-0-1http://www.dssltd.com/book.htm

Page 39: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 39

Example Aspect SQR

reads an SQR file and sets parameters

fix_sql_error

for ON-ERROR=sql_error()

my_prog.sqr

fix_sql_error

my_prog.sqr

Page 40: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 40

Example SQR Language Extension -Stand Deviation & Stack(1)

BEGIN-PROGRAM

BEGIN-SELECTdata &datavar

let #tmp=stddev(&datavar)show ' data = ' &datavar ' new standard deviation = ' #tmp

FROM stddevEND-SELECT

show ' final standard deviation = ' #tmpprint #tmp (1,1) edit 999,999.99999

END-PROGRAM

Page 41: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 41

Example SQR Language Extension -Stand Deviation & Stack(2)

Ufunc source

dss.dll sqrext.dll(NT)

/* (1) Add your new function declarations here. */

/*standard deviation declarations*/double sum=0; //the running sum of the Data Setint counter=0; //the # of valid Data elements in the Setdouble xbar=0; //represents the average of the Data Setint maxBnd=0; //represents the biggest Data Set that has beendeclared in the report so far.double* Data=NULL; //represents the Data Set (dynamic doublearray)

static void stddev(int, double *[],double *); //calculatestandard deviation

static void clr_stddev(int,double*[],double*); //clear dataarray (used for calculating standard deviation./*end of standard deviation declarations*/

• http://www.dssltd.com

• click on clients only• enter user id sqrug• enter password sqrug• select dss.dll install

Page 42: EXTREME SQR PROGRAMMING - DSS Ltd · Gaps/Reqs Functional Technical Code Test Implement Production. ... • Extreme SQR programming can work even though SQR is procedural and not

2/11/2011 http://www.dssltd.com/XSP 42

Example SQR Language Extension -Stand Deviation & Stack(3)

/*stack adt functions - Chris Willson */

struct s_element{ //link list of stack elements is created. This would represent onestack.

char * value; //stack value which is always a string. Can put be '1.00'etc though

struct s_element *next; //pointer to another s_element.};struct stack_node{//link list of stacks

int cur_size; //current size of the stackchar *name; //the name used for this stackstruct s_element * s_ptr; //pointer to stack elememtsstruct stack_node * next; //pointer to another stack

};

static void create_stack(int argc, char* argv[],char* result,int maxvalue);

static void delete_stack (int argc, char* argv[], char* result,int maxvalue);

static void sizeof_stack (int argc, char* argv[], char* result,int maxvalue);

static void push (int argc, char* argv[], char* result,int maxvalue);

static void pop (int argc, char* argv[], char* result,int maxvalue);

static void print_stacks(int argc, char* argv[], char* result,int maxvalue);

struct stack_node* find_stack(char * name); //note NOT called directly by SQR programint first_print = 0; //semiphore so that dss.log only opens file for write once perSQR run

struct stack_node *Stack=NULL; //The head of the Link List of Stacks

/*end of stack delarations*/