Use Cases

--Originally published at Hackerman's house

Use cases is a methodology used to identify, clarify and organize system requirements. Use cases describe the step by step process a user goes to complete a goal using a software system, each use case has an specific goal and it has to consider the things that can go wrong, creating this way not only one path for the user but many paths.

Main characteristics of a use case:

  • Organizes functional requirements
  • Models the goal of the user
  • One main flow of events, and other possible ones (alternate courses of action)
  • Multi-level, this means one use case can use the functionality of another one

21 Steps to Success

Photo by Bernard Goldbach

How to write a use case

You need to have a clear actor, and describe the scope of the use case.

Describe the set of steps the actors take to accomplish the goal of the use case. In case there are alternate flows you have to describe it as well. There is another type of flow, exception flows are the things that prevent the user from achieving their goal, this steps should also be in the use case. The alternate and exception flows must be marked as not part of the main path.
Path less travelled

Photo by Kate Rusell

References:

Brandenburg, L (2018) How to write a use case. Bridging the gap. Retrieved from: https://www.bridging-the-gap.com/what-is-a-use-case/

Unified Software Process

--Originally published at Hackerman's house

The Unified Process is a iterative and incremental software development framework, from which a customized process can be defined. The most popular variation is the Rational Unified Process (RUP), there are others like the Open Unified Process (OpenUP).

There are some key characteristics in the Unified Process;

  • Iterative and incremental development framework
  • Architecture-centric
  • Risk focused
  • Highest risk factors should be adressed as early as possible
  • Use case and UML driven

Each cycle is broken into four different phases, this can have multiple iterations within the phase.

Inception Phase

In this phase you have to establish the goals of the project. The core requirements and features are defined here, as well as the main risks. This phase also includes the initial project plan and early use cases.
planning

Photo by Mike Cohen

Elaboration Phase

The architecture foundation of the system is established. In this part is taken a more detailed analisys and planning. The architecture must consider the most important requirements and risks.

Construction Phase

This is the phase where the software is built, integrated and tested. The user manuals are created and details of the software are ready to be provided to the user.
Day 2 | "The Claw" | 20 December 2007

Photo by Dan Simpson

Transition Phase

Is where the software is deployed to end users, it has a beta testing stage to ensure the software is ready for the user, retroalimentation from the user is really important in this phase.

References

David Olson (2014) Unified Process, recovered from: http://bawiki.com/wiki/concepts/sdlc-process-models/unified-process/

Life cycle

--Originally published at Hackerman's house

The Software Development Lyfe Cycle is a sequence of stages to develop a software product. Some of these stages are:

  • Planning
  • Analysis
  • Design
  • Building
  • Testing
  • Deployment
  • Maintenance

A diagram of the SDLC life cycle.

The main point of Life Cycle is to detect errors in software creation before they are discovered later in the development of the project, this way you can save time and money, this also can improve the quality of the software.

There are many different lifecycle methodologies with different approaches.

Agile

The agile model is relatively new, but in the present is one of the main methodologies used by many software organizations. The agile model is used to satisfy the rapidly changing demands of the clients, being flexible and delivering faster. The projects are divided into short manageable segments, with shorter deadlines and more basic requirements, each segment follows the basic stages managed in short sprints.

Resultado de imagen para agile lifecycle

Waterfall

The waterfall model is the oldest of the methodologies, it is very straightforward, you have a sequence of stages, when you finish one you move on to the next one, you don’t go back and every stage relies on what has been done before. This model is very rigid, which is why it has many cons, an early delay can carry huge loses, and the problems can’t be fixed until you get to the maintenance stage, this can be very expensive as one problem may have caused others in the way.

Other examples of SDLC methodologies

  • Lean
  • Spiral
  • Iterative
  • DevOps

References:

Arkasoftwares (w.d) Agile model software development lifecycle, Recovered from https://www.arkasoftwares.com/blog/agile-model-software-development-lifecycle/

Robert Half (2017) 6 basic sdlc methodologies: Which one is best?, Recovered from https://www.roberthalf.com/blog/salaries-and-skills/6-basic-sdlc-methodologies-which-one-is-best

Creation and use of dictionaries in Python

--Originally published at Quirino´s Projects

dictionaryA very useful data type in python are dictionaries, these could be understand as a list, but each element its a key with its respective value e.g.

We can have a list that holds every word in the english alphabet, but if we wanted to create a program that holds the number of times a letter appears in a string, creating a variable for each letter would be that practical, so a dictionary would be useful

alphabet = {“A”:0,”B”:0,”C”:0,”D”:0…}

Now we have a dictionary that holds a numerical value for each letter, the sintaxis of the dictionary is the following

{} The curly braces contain the dictionary

: The colon separates the key from the value of the key

“A” This is the key, it holds the value next to it

0 Its the value of the key

If we would like to add elements to our dictionary, we simply assign a value to a key is if it was already there

alphabet[“E”] = 5

A useful function when you are working with dictionaries is dictionary.keys(),this function returns the keys in a dictionary as a list, so we could check if a key is in the list before doing something with it

To get more info about dictionaries check:

https://www.tutorialspoint.com/python/python_dictionary.htm

 

 


While and For Loops

--Originally published at Quirino´s Projects

When we want to repeat some code n times, depending on a variable, or until a condition is met, we can use While and For loops

For

A for loop takes a data type, could be a string, a list, a dictionary, and basically every type of data that can be access by its elements, and runs n times were n is the number of elements of the list, and creates a variable each loop with each element

And example, we have a list

myList = [0,1,2,3,4]

And we want to print each element individually, in this case we use the for loop like this

for i in myList:

print (i)

Here the i in the first loop takes the value of 0, then gets printed, then takes the value of 1, then gets printed, and so on the i becomes the value of the index of the list

Here is an example of a program that eliminates spaces from strings

myString = input(“Give me a string: “)

newString =””

for i in myString:

if i != ” “:

newString += i

print (newString)

This program checks each character in the string, if the string is different that a blank space, is not added to the new string

While

A while loop is a loop that runs the code within forever until the condition given is evaluated to False

while True:

print(“I will be printed for ever”)

This is a not correct way of using loop, but serves to explain for While

n = 10

while n <100:

print (“Value of number is {0}”.format(n))

n -= 2

 

 

 

 


Creating functions

--Originally published at Quirino´s Projects

This a little bit hard to catch for early beginners, but trust me these are really easy once you understand how the functions are made.

Sometimes we want to do something many or several times in our code changing only a number or a string, and repeating ourselves makes our program harder to read

keep-calm-and-don-t-repeat-yourself

This is were functions become our ally

If we wanted to get the factorial of 3 numbers, without functions we would need to do this:

num1 = int(input(“N: “))
result1 = 1
for i in range(1,num + 1):
result1 *= i
num2 = int(input(“N: “))
result2 = 1
for i in range(1,num2 + 1):
result2 *= i

num3 = int(input(“N: “))
result3 = 1
for i in range(1,num3 + 1):
result3 *= i

print (num1)

print(num2)

print (num3)

Using the for loop each time makes a bulky code, so instead we could use a function

def factorial(num):
result = 1
for i in range(1,num+1):
result *= i
return result

To explain how a function in python works we need to see each part

def

Stands for define is the keyword needed to tell python that the next thing will be a function

factorial

This is the name our function has and the name it will be called with it can be any name but there are a few conventions about naming things in python

Please Check https://www.python.org/dev/peps/pep-0008/

(num)

These are why functions are a bit hard at first, num is the argument that is passed to the function we defined just one, called num but a function can have as many arguments as we want, this argument is used locally inside the function and we cannot edit it outside the function block for easier understanding lets look at this code

def numberTimesThree(num):

    return

Continue reading "Creating functions"

Python conventions (Zen of Python but others for other languages)

--Originally published at Quirino´s Projects


#Go ahead try this in your python3/2 console

import this

#Just go to shell enter python3/python2 and paste that

20140709_python_bytes_3-11-1

 

Write easy to read code

 

#Python comes helpful to teach you how to indent your code
#Since it won't run if you don't
#Indent makes it easy to understand nested code
if 1 == 1:
    for i in range(5):
            print (&quot;This is the range of 5&quot;)
            for x in range (45):
                if i = 5:
                    print(&quot;We are in the range of 5 of the range of 5&quot;)
#Of course this is a pretty bad example but i think you get the drill
#With indentation you know what things belongs to where

Useful external sources:

7 ways to write beautiful code


Basic output (print)

--Originally published at Quirino´s Projects

The most useful way to interact with Python is with print() it lets you interact with the console as it shows u what is going on, i recommend copying this code then interacting with it to see what you can achieve or just read it and try yourself, there is extra documentation i found useful at the bottom

'''As you might see now the pseudo
tutorial will be all written in Python
This way you could just copy the code and test yourself'''
#The most basic thing we learn to print in Python is
#The one and only, the world famous Hello world
print (&quot;Hello world&quot;)
'''In python 3.something print works as a function.
It takes one argument which can be a string like Hello world
or a variable as it could be'''
string_x = &quot;Hello world&quot;
print (string_x) #Prints Hello World
#[Note for Myself add a link to Basic types and their use]
'''As you can see im jumping from single line comments to multi
when its needed, &quot;...because i can&quot;-Ken Bauer'''
#You can print to the screen more types like integers or floats
int_x = 10 #Prints 10
float_x = 20.0 #Prints 20.0
#NOTE we are not using the same x or something each something_x
#Its used only for names [Note for self, add tips on calling things]
print (int_x) #Prints the int_x value
print (float_x) #Prints the float_x value
'''Sometimes you want to print something more than just the
value of something thats when concatenating comes useful'''
hello = &quot;Hola&quot;
world = &quot;Mundo&quot;
print (hello + world) #This is a bit problematic since it Prints
#HolaMundo together so we need
print (hello + &quot; &quot; + world )
'''If we would need to print a string with a lots of variebles in it
Continue reading "Basic output (print)"

Use of comments

--Originally published at Quirino´s Projects

Comments come very useful when it comes to writing your program, it helps you to do organized code and more easy to understand, for you, or who ever needs to evaluate your code, for example instead of naming a function.

Commentaries do not affect your code

 def a_function_that_adds_two_numbers_and_returns_its_double(x,y):
    pass
 

You could just do

 
#This function adds two numbers and returns its double
def add_double(x,y):
    pass
 

Even tho you know what your codes do, sometimes is useful to let others understand easier and faster what you are trying to to, or you just could forget what the function/method meant like me

Another useful tip for python are multi-line comments using

''' love sheep.

So do I. Terrific animals. Terrific.

trouble.

No, no trouble.

Except at shearing. They can play up a bit, then; can't they?'''

Unlike single line comments #, you need to close the ”’ or you will have problems

Like this:

''' This program is useful when you want to add two numbers.
It reads from the user 2 input and returns its sum
def add():
x = input("Please Give me a number: ")
y = input("Input another one: ")
return ("The sum of %s and %s is %s") % (x,y,x+y)
print add()

This would run generate the following error:

File “Mastery_Topics_Comments.py”, line 10

SyntaxError: EOF while scanning triple-quoted string literal

This would be the right way: (You could copy this code but i don’t know how to indent in wordpress editor) delete [TAB] and tab it yourself

''' This program is useful when you want to add two numbers. It reads from the user 2 input and returns its sum'''
def add():
[TAB]x = input("Please Give me a number: ")
[TAB]y = input("Input another one: ")
[TAB]return ("The sum of %s and %s is %s") % 
Continue reading "Use of comments"