diff options
author | hardythe1 | 2012-08-24 12:49:39 +0530 |
---|---|---|
committer | hardythe1 | 2012-08-24 12:49:39 +0530 |
commit | 5dc254097176489bfd2834a66fe437fe62a36fb8 (patch) | |
tree | d7954f4c4496a45f0e5c73ea59056687754a6d20 /script2col.rst | |
parent | 7ee1718d5b9d6f8450cb5cdd023b8a067f8d06ec (diff) | |
download | sdes-stscripts-5dc254097176489bfd2834a66fe437fe62a36fb8.tar.gz sdes-stscripts-5dc254097176489bfd2834a66fe437fe62a36fb8.tar.bz2 sdes-stscripts-5dc254097176489bfd2834a66fe437fe62a36fb8.zip |
modified script & slides according to the new checklist
Diffstat (limited to 'script2col.rst')
-rw-r--r-- | script2col.rst | 205 |
1 files changed, 79 insertions, 126 deletions
diff --git a/script2col.rst b/script2col.rst index d7f8dd5..cb4bf71 100644 --- a/script2col.rst +++ b/script2col.rst @@ -1,156 +1,109 @@ --------- +------ Script --------- +------ +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{ Show the title slide}}} | Hello friends and welcome to the tutorial on Latex: Tables & Figures. | +| {{{ Show the "Title" slide }}} | Hello friends and welcome to the tutorial on, | +| | 'Getting started with TDD' | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide containing the objectives}}} | In this tutorial we will learn how to: | +| {{{ Show "Objectives" slide }}} | At the end of this tutorial, you will be able to, | | | | -| | 1. Add figures in Latex document. | -| | | -| | #. Include tabular environments in Latex document. | +| | 1. Understand basics of Test Driven Development. | +| | #. Understand the use test cases. | +| | #. Write simple tests for a function. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'Prerequisites'}}} | Please make sure that you have gone through the following tutorials before you | -| | continue on this tutorial: | -| | | -| | 1. Latex Installation | -| | #. Latex Introduction | -| | #. Latex Basics & Structuring | -| | #. Latex Typesetting Text | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'Figures'}}} | Let us start with seeing how to include 'figures' in a Latex document. | -| | To include graphics in a LaTeX document, we need to use the <graphicx> package. | -| | To use this package, we have to add the <\\usepackage{graphicx}> directive | -| | to the preamble of the document. | -| | | -| | Then, to add a graphic, use the <\\includegraphics> command. | -| | The relative path of the image that we wish to include is passed as an | -| | argument to includegraphics. You can see two images in each slide of this | -| | presentation, these images are included using <\\includegraphics> command. | -| | It takes an optional argument, to scale an image. For our images a scale | -| | of 0.80 is used. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show slide 'includegraphics'}}} | <\\includegraphics> command also takes other optional arguments such as: | -| | | -| | 1. <width=x, height=x> | -| | | -| | If only the height or width is specified, the image is scaled, | -| | maintaining the aspect ratio. | -| | | -| | #. <keepaspectratio> | -| | | -| | This parameter can either be set to true or false. | -| | When set to true, the image is scaled according to both width and height, | -| | without changing the aspect ratio, so that it does not exceed both the | -| | width and the height dimensions. | -| | | -| | #. <angle=x> | -| | | -| | This option can be used to rotate the image by x degrees, counter-clockwise. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show slide 'includegraphics..'}}} | Here is the complete syntax for <\\includegraphics> command with | -| | the optional arguments we just talked about and the relative path | -| | to the image. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'Floats'}}} | Graphics (and tables) are treated specially because, | -| | they cannot be split into pages. | -| | They are "floated" across to the next page, | -| | if they do not fit on the current page, filling the current page with text. | -| | To make our graphic into a float, we should enlose it within | -| | a figure environment. The figure environment takes an additional parameter | -| | for the location of the float. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'Floats..'}}} | The specifiers 't','b','p','h' & '!' are permissions to place the float at | -| | various locations. | -| | 't' for top of page, 'b' for bottom of page, 'p' for a separate page for | -| | floats and 'h' for here, as in pproximately at the same point it occurs in | -| | the source text. '!' mark overrides few of LaTeX's internal parameters | -| | for good position of floats. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide Captions and References}}} | The figure environment also, allows us to add a caption to the graphic | -| | using the <\\caption> command. This command will be placed within the figure | -| | environment. | -| | To keep the graphic center aligned in the page, | -| | we use the center environment within the figure environment. | -| | To label a figure, we just add a <\\label> command within the | -| | figure environment. | -| | Note that the label to a figure should be added after the caption command. | -| | Figures are auto numbered. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide Captions and References..}}} | Here, you can see a sample code that shows the use of figure environment | -| | with caption & label. | -| | It explains how to include image, how to center align it. | -| | Also shows, how to add caption and label to an image. | -| | You can note that the label is added after the caption, as we mentioned | -| | earlier. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'Tables'}}} | Now, let us look at how to include Tables in our document. | -| | To typeset content in a tabular format, we use the tabular environment. | -| | And to make it a float, it is enclosed in the table environment. | -| | The table environment also allows us to add captions & labels to the table, | -| | just as we added in the figure environment. | -| | Tables are also auto numbered. | -+----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'tabular'}}} | The tabular environment takes the columns, and the formatting of each column, | -| | as arguments. The possible arguments to the tabular environment are | -| | | -| | 1. l for left justified column content | -| | | -| | #. r for right justified column content | +| {{{ Switch the "Pre-requisite" slide }}} | Before beginning this tutorial, we would suggest you to complete the | +| | tutorial on "Getting started with functions". | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ show "What is TDD?" slide }}} | Test-driven development is a software development process that relies on the | +| | repetition of a very short development cycle. | | | | -| | #. c for centered column content | +| | The basics of Test Driven Development are, | | | | -| | #. | (pipe) produces a vertical line. | +| | 1. Decide the new feature you want to implement & the methodology to test it. | +| | #. Write tests for the new feature decided upon. | +| | #. Just write enough code so that the test can run, but, it fails. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'tabular..'}}} | Tabular also takes an optional parameter that specifies the position | -| | of the table; 't' for top, 'b' for bottom, or 'c' for center. | -| | Each column of a table is separated by an '&' (ampersand) symbol and | -| | each row is separated by a new line. | -| | | -| | The <\\hline> command allows you to draw horizontal lines between | -| | two rows of the table. | +| {{{ show "What is TDD?.." slide }}} | #. Modify the code so that all the current tests & the previous tests pass. | +| | #. Run tests to see if all the tests pass successfully. | +| | #. Refactor the code - optimize the algorithm, remove duplication & | +| | documentation, etc. | +| | #. And finally run the tests again to see if all the tests pass. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'tabular..'}}} | A sample code that shows the complete use of the tabular | -| | environment with all arguments and options. | +| {{{ show "First test - fibonacci" slide }}} | To illustrate TDD, lets take a simple program. Consider a function "fibonacci", | +| | that takes one argument and returns the nth number of fibonacci series. | +| | As shown in the example, c will contain the 3rd digit of the fibonacci series | +| | that starts counting from 0(zero). | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the slide 'List of Tables, Figures'}}} | You could also add a list of tables or list of figures to the document, | -| | using <\\listoftables> & <\\listoffigures> commands respectively. | +| {{{ show "Test Cases" slide }}} | To test any function it is important to have enough test cases & their expected | +| | outputs before you start writing the test cases. Test cases are expected | +| | outputs for a given set of inputs. So, to test fibonacci function, | +| | we need test cases. As shown in this slide, our test cases are, when 'n=3', '2' | +| | is the expected output from the fibonnaci series. Similarly, when 'n=4', '3' | +| | is the expected output. | +| | Test cases can either be true or false depending on their actual behaviour | +| | against the expected behaviour. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the 'summary' slide'}}} | This brings us to the end of the tutorial. In this tutorial, we have | -| | learnt to, | -| | | -| | 1. Add graphics to a LateX document | -| | | -| | #. Include tabular environments in a LateX document | +| {{{ show "Test cases-Code" slide }}} | The sample code for test cases is shown here. Observe that if any "if" | +| | statement is executed, test aborts after printing the error message. | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ show the "Stubs" slide }}} | Now, the fibonacci function is written just enough so that the tests can run. | +| | But, obviously the tests are going to fail. | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ show "fibonacci.py" slide }}} | We will now combine the fibonnaci stub function we just wrote & the test cases | +| | together in "fibonacci.py" file. Note that the test cases should be added | +| | after "name=main" idiom. | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ show the "first run" slide }}} | Now, let us run the fibonacci.py file. To do this, switch to the terminal & | +| {{{ Run the fibonacci.py in terminal and show the error output & switch back to | type "python fibonacci.py". | +| slide }}} | | +| >>> python fibonacci.py | | +| | The tests fail as we just have a stub "fibonacci" function and no meaningful | +| | code in it. Our next step is to write just minimum code to pass our tests. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show self assessment questions slide}}} | Here are some self assessment questions for you to solve, | +| {{{ show "Fibonnaci" slide }}} | Modify the fibonacci stub function with given code & save the file. Now, switch | +| {{{ switch to terminal }}} | to terminal and run it again as "python fibonacci.py". | +| >>> python fibonacci.py | | +| | {{{ pause }}} | +| | Observe that, there will be no errors, as the test passes successfully. | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ Show "Fibonacci - Recursive" slide }}} | Finally, the same "fibonacci" function is modified to make it more readable | +| | and easy to understand using recursion. | +| | Pause this video here. Replace the "fibonacci" function with recursive one. | +| | Run the modified "fibonacci.py" file. The test should pass again without any | +| | errors. After successfully achieving this result, you can resume the video. | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ show "Summary" slide }}} | This brings us to the end of the tutorial. In this tutorial, we have learnt, | | | | -| | 1. Which input parameter is used in the figure environment to make it float | -| | to the bottom of the page ? | -| | #. What is the mandatory argument in tabular environment specification ? | +| | 1. The basic steps involved in Test driven development. | +| | #. How to use test cases. | +| | #. How to write simple tests for a function. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{Show the solutions slide to self assessment questions }}} | And the answers, | +| {{{ show "Evaluation" slide }}} | Here are some self assessment questions for you to solve, | +| | | +| | 1. Design a TDD approach for a factorial function. | +| | 2. Design a TDD approach for an armstrong function. | | | | -| | 1. Input parameter `b' is passed as argument, to make it float to the bottom | -| | of the page. | -| | #. It is mandatory to specify alignment of each column in tabular | -| | environment. | +| | Try out the excercises for yourself & resume the video for solutions. | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ show "Factorial" slide}}} | Given here is a TDD approach to a factorial function. | ++----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ +| {{{ show "Armstrong" slide}}} | Given here is a TDD approach to an armstrong function. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ | {{{ Show the SDES & FOSSEE slide }}} | Software Development techniques for Engineers and Scientists - SDES, is an | | | initiative by FOSSEE. For more information, please visit the given link. | | | | -| | Free and Open-source Software for Science and Engineering Education - FOSSEE, | -| | is based at IIT Bombay which is funded by MHRD as part of National Mission on | +| | Free and Open-source Software for Science and Engineering Education - FOSSEE, is | +| | based at IIT Bombay which is funded by MHRD as part of National Mission on | | | Education through ICT. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{ Show the About the Spoken Tutorial Project slide }}} | Watch the video available at the following link. It summarises the Spoken | +| {{{ Show the ``About the Spoken Tutorial Project'' slide }}} | Watch the video available at the following link. It summarises the Spoken | | | Tutorial project.If you do not have good bandwidth, you can download and | | | watch it. | +----------------------------------------------------------------------------------+----------------------------------------------------------------------------------+ -| {{{ Show the Spoken Tutorial Workshops slide }}} | The Spoken Tutorial Project Team conducts workshops using spoken tutorials, | +| {{{ Show the `` Spoken Tutorial Workshops'' slide }}} | The Spoken Tutorial Project Team conducts workshops using spoken tutorials, | | | gives certificates to those who pass an online test. | | | | | | For more details, contact contact@spoken-tutorial.org | |