Mastery 12 – Testing in OO

In object-oriented (OO) paradigm, for software testing the engineer must identify and specify the objects and services provided by each object. In addition, interaction of any two objects and constraints on each identified object are also determined, all these become the scope of the testing.

OO program should be tested at different levels to uncover all the errors. white-box testing can be applied easily at the algorithmic level, which means that each module (or method) of every class in the program should be tested in isolation. For the testing of classes, every class should be tested as an individual entity. At this level, programmers who are involved in the development of class conduct the testing. After performing the testing at class level, cluster level testing should be performed. As classes are collaborated (or integrated) to form a small subsystem (also known as cluster), testing each cluster individually is necessary. At this level, focus is on testing the components that execute concurrently as well as on the interclass interaction. Hence, testing at this level may be viewed as integration testing where units to be integrated are classes. Once all the clusters in the system are tested, system level testing begins. At this level, interaction among clusters is tested.

Test cases can be drawn from requirements specifications, models, and the language used. In addition, structural testing methods such as boundary value analysis are extremely used.

One common misconception is that if individual classes are well designed and have proved to work in isolation, then they work well when they are integrated. However, this is not true because sometimes there can be errors, which can be detected only through integration of classes. Also, it is possible that if a class does not contain a bug, it may still be used in a wrong way by another class, leading to system failure.

The parts of a test case are:

  1. It should be explicitly specified with each test case which class it should test.
  2. Purpose of each test case should be mentioned.
  3. External conditions that should exist while conducting a test should be clearly stated with each test case.
  4. All the states of object that is to be tested should be specified.
  5. Instructions to understand and conduct the test cases should be provided with each test case.

There are 3 testing methods:

State-based testing: is used to verify whether the methods of a class are interacting properly with each other. For this testing, finite-state machine (FSM) representing the possible states of the object and how state transition occurs.

Fault-based testing: is used to determine or uncover a set of plausible faults. Fault-based testing starts by examining the analysis and design models of OO software as these models may provide an idea of problems in the implementation of software. With this knowledge the tester designs test cases which aim to uncover some particular faults.

Scenario-based testing: is used to detect errors that are caused due to incorrect specifications and improper interactions among various segments of the software. The structure of a scenario includes the following points.

  1. A condition under which the scenario runs.
  2. A goal to achieve, which can also be a name of the scenario.
  3. A set of steps of actions.
  4. An end condition at which the goal is achieved.
  5. A possible set of extensions written as scenario fragments.

References

Thaku, D. (n.d.). Object-Oriented Testing. EComputer Notes. http://ecomputernotes.com/software-engineering/object-oriented-testing

 

Mastery 10 – Code Revision

Code Revision or Code Review is when another programmer review your code to find problems with it, this process brings the following advantages, first you make sure that your code is readable, you check that it fits with the architecture, shares your knowledge, and last it finds buggs in your code.

There are 2 types of code reviews: based on pull requests and pair programming, pull requests can be done remotely and is basically uploading your code to github or other version manager and having another programmer check it and submit his opinions; in pair programming the code review is done immediately because from the beggining there are two programmers coding, one takes the role of the driver(coder) while the other is the observer(big image viewer).

While doing a code review you sould look for the unhappy paths, the tests added, if the feature cover the specs, performance and security.

«With code reviews… You own the code.. As a team».

1.Remember you are a team so let everyone participate.

2.Question everything (Don’t really need to be everything).

3. If needed get a 3 opinion

Reference

Coding Tech (2018). The Science of Code Reviews. Youtube: https://www.youtube.com/watch?v=EyL7mqwpZhk

 

 

Mastery 11 – Verification and Validation

In the software context verification and validation refers to making sure that the software do what it is supossed to, this to ensure the quality of the software, that’s why this is also refered to as quality control, even though both verification and validation may be seen as verifying the functionality they posses a different context, because verification is related to making sure it does what you imagined and validation is making sure it does what the client imagined, this is why these terms may look so alike.

When talking about validation there are two ways to perform it: internal and external. During internal software validation, it is assumed that the goals of the stakeholders were correctly understood. If the software meets the requirement specification, it has been internally validated. External validation happens when it is performed by asking the stakeholders if the software meets their needs. Different software development methodologies call for different levels of user and stakeholder involvement and feedback.

Used tools for software validation are test cases and reviews. Test cases may be prepared for software verification and software validation to determine if the product was built according to the requirements of the user. Reviews may be used early in the life cycle to provide for software validation.

References:

Wikipedia (2019). Software verification and validation, https://en.wikipedia.org/wiki/Software_verification_and_validation

HFOOAD Chapter10 – «Putting It All Together»

This chapter is the last one, it focuses in how to apply all that we learned into developing great software.Annotation 2019-05-07 155051

Figure 1: The Object Oriented Analysis & Design Project Lifecycle. Retrieved from McLaughlin, B. (2006). Head First Object-Oriented Analysis and Design. Sebastopol, CA: Mary O’Brien page 485

I liked this cool map, very useful if you ever get lost.

Annotation 2019-05-07 155847

Figure 2: A Cool Map. Retrieved from McLaughlin, B. (2006). Head First Object-Oriented Analysis and Design. Sebastopol, CA: Mary O’Brien page 485

This chapter is only a recap from all seen in the book so if you haven’t read it by now feel free to read my blog and leave your questions and comments.

HFOOAD Chapter 9 – «The Software is Still for the Customer»

When talking about giving your costumer the system he wanted it’s important to know that there are two options, option one is to select a random feature and work until that’s done until you finish with all features (Feature list)or option two is to pick a scenario and write code to complete that scenario through the use case until you are done with all use cases (Use case diagram).

Captura de pantalla 2019-04-22 a las 17.16.30

Figure 1: Pros and Cons of feature driven and use case driven iteration methodologies. Retrieved from McLaughlin, B. (2006). Head First Object-Oriented Analysis and Design. Sebastopol, CA: Mary O’Brien page 430

Now we begin to see test scenarios, this are going to show that your code works by testing the normal paths and also the paths outside of the norm, you should test every possible scenario you can think of, even user errors.

Now for the code remember to apply the learned principles, read about them here.

Test cases must contain the following:

1. ID and Name

2. Specific thing to test

3. Input

4. Expected output

5. May have a starting state

Example:

Captura de pantalla 2019-04-22 a las 17.34.00

Figure 2: Test cases design example. Retrieved from McLaughlin, B. (2006). Head First Object-Oriented Analysis and Design. Sebastopol, CA: Mary O’Brien page 459

 

References:

McLaughlin, B. (2006). Head First Object-Oriented Analysis and Design. Sebastopol, CA: Mary O’Brien

 

HFOOAD Chapter 8 – «Originality is Overrated»

This chapter begins by talking about design patterns.

#1 Open-Closed Principle: closed to modification but open to extension, so in case of special cases your code still works but they just overdrive what varies.

#2 Don’t Repeat Yourself Principle: Avoid duplicated code by abstracting whats common.

#3 The Single Responsibility Principle: Every object must have only one responsibility and all whats inside should aim to take care of that responsibility.

#4 The Liskov Substitution Principle: it’s a well designed inheritance, when you inherit from a base class and you substitute in your system your subclass for the base class things should not go terribly wrong.

I had seen or notice most of this things before reading this chapter so this chapter was somewhat boring and this is what I guess I would need to remember this chapter.

 

References:

McLaughlin, B. (2006). Head First Object-Oriented Analysis and Design. Sebastopol, CA: Mary O’Brien

 

Blogging and me (analysis)

Blogging and me is a blog post from Ana which you can find here, in essence the blog is about her personal experience with blogging and the tech industry.

From her post I liked how she escaped from social media when she noticed it made her misserable, I trully applause that, I have been doing this myself for a while now, now I only use Youtube and 9GAG which are way different from Facebook and other social media, mainly in the fact that I do enjoy them, but this is the only thing I could identify with as the other part of the blog post was abou how she recovered the confidence to start blogging again and how to encourage other to gain that confidence, and I really don’t lack that confidence, I do feel like a junior too but I know everybody has been a junior in their field, and I know that even the most expert programmer fails in basic things, so I didn’t think that what I learned was basic.

I didn’t find the blog useful to me because the reason I don’t blog for pleasure is because I don’t like shearing personal stuff nor writhing my thoughts in the internet for everyone to see, when I do share my thoughts it’s in person with the people of my trust, I know I’m blogging right now but it’s for an assignment.

SimSE

This is my experience playing SimSE three unsuccessful times from which I only remembered to take a screen shot in the last which can be seen at the end of this post.

The version I played was the Waterfall one, and no mather what I did I could’t get more than 14 out of 100, I guess I followed too much the Waterfall definition and not much about tools and experience of the employees, also probably finishing after the time and budget is severely punished as well as not finishing, so it wasn’t a great learning tool for me but it was interesting and somewhat fun. I rate it 5/10 in teaching and 8/10 in inovation, overall fun experience but not good for teaching.

Cascada

Mastery 09 – Classes to Code

This is an extensive subject therefore we will only review the object oriented mapping to code.

Object design mapping has the following chracteristics:

  • Developers perform transformations to the object model to improve its modularity and performance.
  • Developers transform the associations of the object model into collections of object references, because programming languages do not support the concept of association.
  • If the programming language does not support contracts, the developer needs to write code for detecting and handling contract violations.
  • Developers often revise the interface specification to accommodate new requirements from the client.

When mapping from a model to code there are 4 types of model trasformation, which are the following:9.1

Figure 1: Model transformations. Chapter 10,Mapping Models to Code. https://www.utdallas.edu/~chung/CS6354/ch10lect1.ppt

Model Transformation

Refactoring

Forward Engineering

Reverse Engineering

This happens when you want to recreate the model starting from the code, the same way as you created the code from the model now you create an UML class for each class declaration statement, adds an attribute for each field, and adds an operation for each method.

Conclusion

This can be very useful when object oriented programming as it’s easier to follow the already thought model and even optimize the code all from the begging just by following some easy set of rules, caution is required for other programming ways because as we saw earlier the assosiations and contracts vary from one to another.

References

Bernd Bruegge and Allen H. Dutoit, «Object-Oriented Software Engineering», Third Edition, Chapter 10

 

HFOOAD Chapter 7 – “Bringing Order to Chaos»

Now that we have all these small problems we need to know where to start, here is where the architecture takes impirtance as it helps determine importance and the role of each little peace and that way decide an order of development, there are 3 questions in architecture you can ask yourself to determine the order of importance: Is it essential for the system? can you imagine the software without it; Do you know what it means? you better try to understand the feature from end to end before programing as it might interfere lather on; Do I know how to do it? if its a new area or concept to you, better learn what you have to learn before programming it. With these questions you can review each feature in the feature list and find the key features of your system, that way you have where to begin with, once you have the keyfeatures you can argument with your team of yourself with which to begin with, it doesn’t matter that much with  which of them you start but its better to choose the one that reduce the risk more.

Other advices are to focus on one task at a time and only begin with the more important ones.

Some problems might require a Commonality analysis which is a path to add flexibility a similiar way as encapsulation does by searching whats things gets repeated and can get encapsulated in a function or object.

Only the beginning of the chapter was generic enough for me to consider it useful, when it began talking about the solution to each key feature the chapter was more like a guide to how to code a risk game, so I will not write more about this.

McLaughlin, B. (2006). Head First Object-Oriented Analysis and Design. Sebastopol, CA: Mary O’Brien