Вы находитесь на странице: 1из 32

JSONTOCBOR

Python Converter
OVERVIEW
Sprint 1 overview
Sprint 11 overview
Burndown chart
Testing
Whats next
SPRINT 1
Estimated Actual
Learn Python 20 25
Learn RegEx 2 2
Learn about JSON and CBOR 8 6
Learn about version control systems 2 1
Setup project 6 5
Download needed tools
Setup version control (Git, Bitbucket, Sourcetree)
Setup Continuous Integration (Bitbucket Pipelines)
SPRINT 1 BURN-DOWN
Sprint 1 Burn Down Chart
40,000
38
36
35
33
33,333
31

27
26,667

22
Points

20,000
18

14
13,333
10
8
6,667 5
4
3
1
0
0,000
Time in Days
Remaining Ideal Velocity
PRODUCT BACKLOG
As a customer I want to convert
JSON objects to CBOR because it
can support systems with limited
requirements.
Refine

JSON objects consisting of String key-


value pairs.
JSON objects containing numbers.
JSON objects containing Arrays.
JSON objects containing Objects.
PRODUCT BACKLOG

As a customer I want to be able to


select a text file with JSON data and
get resultant CBOR conversion
because I have legacy dataset in JSON
format.
As a customer I want the CBOR
resultant conversion saved into a file
because systems I usually work with
read CBOR from files.
SPRINT 11
Backlog tasks Sprint 11 tasks
Convert JSON objects consisting
of String key-value pairs
Convert JSON objects containing
Numbers
Convert JSON objects containing
Arrays
Convert JSON objects containing
Objects
Select a text file with JSON data
and get resultant CBOR
conversion
Save the CBOR resultant
conversion saved into a file
SPRINT 11
Estimated Actual
Convert JSON objects consisting
of String key-value pairs 5 2
Convert JSON objects containing
Numbers:
Positive Integers 5 3
Negative Integers 3 2
Floating Point numbers
8 8+
Determine Testing Methodologies 10 8
Make Sprint Statistics 5 6
SPRINT 11
SPRINT 11
SPRINT 11
SPRINT 11 BURN-DOWN
Sprint 2 Burn Down Chart
40
40,000 38 38

35
33
33,333
30
28
26,667 25
22
Points

20
20,000

15
13,333 12

6,667 6
3

0
0,000
Time in Days
Remaining Ideal Velocity
SPRINT 11
Task 1: String Conversion Function

Main task: Create a function which


takes as parameters the key and value
from the map and convert the content
to CBOR equivalent.
{
name : John,
nickname : Johny
}
STRING CONVERSION
FUNCTION
Overview: The function converts the
JSON consisting of string values (major
data 3) to CBOR

Parameters: key, value string pairs -the


components of the dictionary {
name : John,
Returns: None nickname : Johny
}
STRING CONVERSION
FUNCTION
If there is a string in the JSON File, then
the StringToCbor function is called.

Mechanism: The function constructs the


header, which is a string by default, and
then constructs the value according to {
CBOR standard.
name : John,
nickname : Johny
}
SPRINT 11
Task 11: Encode integers

Main task:
Create code for unsigned integers
Learn the rules to encode Mayor type
0
Write the code to encode the
positive integers {
Age : 20,
Create code for negative integers Grade : -10
Learn the rules to encode Mayor type
1
}
Write the code to encode the
negative integers
ENCODE INTEGERS

Overview: The function converts the


JSON consisting of integer values (positive
(major type 0) or negative (major type 1))
to CBOR

Parameters: key, value pairs -the


components of the dictionary
{
Age : 20,
Grade : -10
Returns: None
}
ENCODE INTEGERS
If there is a string in the JSON File, then the
IntToCbor function is called.

Mechanism: The function constructs the key


header, which is a string by default, and then
constructs the value according to CBOR
standard.
if the value is bigger than 23, the function {
outputs extra information to represent
the integer in hexadecimal. Age : 20,
If the integer is negative, the value of the Grade : -10
header will change and the number will }
be represented as the absolute value of
the input -1
SPRINT 11
Task 11: Floating Point Conversion

Main task: Write a function that can


convert floating point numbers and
simple values to binary representation.

{
Num1 : 20.5,
Num2 : 10.32
}
FLOATING POINT
CONVERSION
FLOATING POINT
CONVERSION
Overview: Two functions, One takes care
of the IEEE standard, and one that handles
the simple value with no content.

Parameters: key, value pairs -the


components of the dictionary
{
Num1 : 20.5,
Returns: None Num2 : 10.32
}
FLOATING POINT
CONVERSION
For simple values with no content it
checks if its Boolean, or simple floating
numbers. And then sets the header
value to a binary representation.

The other function finds a


representation for floating point
numbers according to the IEEE 754 {
standard, with Half-Precision, Single Age : 20,
Precision, and Double Precision Float.
( 16-, 32-, 64 bits) Grade : -10
}
FLOATING POINT
CONVERSION
Problems:

CBOR does not convert the floating


numbers according to the IEEE 754
standard.
It took more time than expected
because we also had to read through
and understand how the IEEE 754
standard is working. {
We got some code working but the
Age : 20,
function is not completed. Grade : -10
}
RETROSPECTIVE
ArrayToCBOR function
Problem:
For every value in the array, the function should call the existing string, int,
and float functions, but these take 2 parameters (keys and values) from
the dictionary whereas they are expected to be called with just one value.
Solution:
Refactor the string, int, float functions such that they will take only one
parameter based on the value type, but not on the key.
CODING METHODOLOGY
Global Function

Numbers Converters
String Converter (Positive, Negative, Floating Point)

Read JSON from file Read JSON from file


Define Key headers and Define Key headers and
parse their values parse their values
Define string value header
and parse its value Helper Functions Define Number value header
and parse its value
Loop through all string key-value Loop through all similar key-value
pairs and do the same pairs and do the same
Write CBOR to file Write CBOR to file
TESTING
Verification
Make sure the product behaves the
way we want it to.
Validation
Make sure the product is built as per
customer requirements
VERIFICATION
Unit Testing
Unit testing is the testing of an
individual unit to see if it is producing
expected output against given input.
UNIT
String Converter

Read JSON from file


Define Key headers and
parse their values
Define string value header
and parse its value
Loop through all string key-value
pairs and do the same
Write CBOR to file
VERIFICATION
Integration Testing
Testing in which a group of
components are combined to
produce output.

UNIT UNIT UNIT


+ +
VERIFICATION
Blackbox Testing
Making sure output is right and
ignoring the internal mechanism.

Input Output
cbor.me
VALIDATION
Acceptance Testing
Done by the customer to ensure that
the delivered product meets the
requirements and works as the
customer expected.
WHATS NEXT
Backlog tasks Sprint 111 tasks

Convert JSON objects containing


Arrays
Convert JSON objects containing
Objects
Select a text file with JSON data
and get resultant CBOR
conversion
Save the CBOR conversion saved
into a file
JSONTOCBOR
Thank you.

Вам также может понравиться