quarta-feira, 21 de junho de 2017

SW Construction: Checkstyle in Eclipse

The short story

Checkstyle is a static analysis tool with an Eclipse Plugin (it also has a Maven plugin), that allows you to... check style. An excellent article describing how to install, configure for a project and run for reporting (things about style, duh) can be found here:

The Long Story

... made short by Wikipedia: https://en.wikipedia.org/wiki/Checkstyle

Some modules are readily available, saving you lots of time configuring the tool:

"Checkstyle defines a set of available modules, each of which provides rules checking with a configurable level of strictness (mandatory, optional...). Each rule can raise notifications, warnings, and errors. For example, checkstyle can examine:
  1. Javadoc comments for classes, attributes and methods;
  2. Naming conventions of attributes and methods;
  3. Limit of the number of function parameters, line lengths;
  4. Presence of mandatory headers;
  5. The use of packets imports, of classes, of scope modifiers and of instructions blocks;
  6. The spaces between some characters;
  7. The good practices of class construction;
  8. Duplicated code sections;
  9. Multiple complexity measurements, among which expressions." (Source: Wikipedia)

Similar tools

If you're into .Net, think FxCop: 

Estimation: PERT / Three Point Estimation Technique

The estimation technique in Agile is Planning Poker.
As for Waterfall, a combination of decomposition (WBS), PERT / 3 point estimation (weights sum up 6) and iterative reevaluation could be used.
What is exactly the 3 point estimation and PERT? Google says:
Quoting Tech Republic:
"PERT is an estimating technique that uses a weighted average of three numbers (see below) to come up with a final estimate.

  • The most pessimistic (P) case when everything goes wrong [also called "Worst Case Scenario"]
  • The most optimistic (O) case where everything goes right [also called "Best Case Scenario"]
  • The most likely (M) case given normal problems and opportunities [also called "Expected Case Scenario"]

The resulting PERT estimate is calculated as (O + 4M + P)/6. This is called a "weighted average" since the most likely estimate is weighted four times as much as the other two values. You'll notice that the final PERT estimate is moved slightly toward either the optimistic or pessimistic value - depending on which one is furthest from the most likely. Generally this ends up moving the final estimate toward the worst case, since the worst case value tends to be further out from the most likely that the optimistic number."

Some tools (like MS Project) will allow you to do some What If scenarios, by defining different weights  (above the weights are 1, 4, 1, and all weights should sum up to 6). What if it is most probable that mostly everything goes wrong (could be tested with weights like 1, 1, 4). What if mostly everything goes right (4, 1, 1)?


terça-feira, 20 de junho de 2017

SW Construction: The list of lists to learn to code

https://www.google.pt/search?q=best+sites+to+learn+to+code&oq=best+sites+to+learn+to+code&aqs=chrome..69i57j0l3.32006j0j4&client=ms-android-xiaomi&sourceid=chrome-mobile&ie=UTF-8

segunda-feira, 19 de junho de 2017

SW Construction: Generators tutorial (Python)

http://www.dabeaz.com/generators/
(PDF presentation "inside")

Quoting:
"This tutorial discusses various techniques for using generator functions and generator expressions in the context of systems [read: command line script] programming. This topic loosely includes files, file systems, text parsing, network programming, and programming with threads."

Example source code in the link above (Python).

quarta-feira, 14 de junho de 2017

Development Tools: The 10 tools every "modern developer" should use

The always polemic list of things. But maybe you will find something interesting here (out of 10):

The 10 tools every modern developer should use | InfoWorld

The list (details are on the link, please do follow):

  1. Git and GitHub (version control system); 
  2. SSH (to create an SSH key or do other SSH stuff); 
  3. Terminal Services or remote login (to access remote Windows machines) 
  4. Amazon Web Services (AWS isn’t just cloud; know at least the EC2 stuff); 
  5. JavaScript (the scripting language of the now; widely used for scripting APIs); 
  6. Bash and PowerShell (in Linux, many Unixes, MacOS, and Windows 10 / Microsoft’s PowerShell; also make sure to learn to use Grep / PowerShell’s Select-String); 
  7. MongoDB (document database; Apache Solr - document-shaped); 
  8. Curl and Invoke-RestMethod (for REST APIs; On Mac and Linux, Curl is the command-line tool that lets you test and tweak and even script against a REST API; in PowerShell, it is Invoke-RestMethod; equivalent GUI tools like Postman); 
  9. Markdown (format of the README.md file in GitHub; just seven symbols: # is a header, ## is a subheader, * is a bullet, __ and ** are bold, _ and * are italics, ` is monospace, and --- is a break or rule; learn to convert to slides, PDFs, and HTML with or without CSS); 
  10. Basic HTML

Source: Link above.

terça-feira, 13 de junho de 2017

SW Testing: Code coverage criteria (including MC/DC)

The Short Story

Just a sum-up of coverage criteria (software testing):
Code coverage - Wikipedia

The Long Story

Besides coding, you might get asked to provide several types of coverage of your code (the evidences to provide to your contractor could be test report deliverables, besides the [automated] test scripts and the written test specs/procedures). The more safety-critical is your code the more criteria you will be mandated to execute (the QA / PA standards refer to these issues):
  • Function coverage – Has each function (or subroutine) in the program been called?
  • Statement coverage – Has each statement in the program been executed?
  • Branch coverage – Has each branch (also called DD-path) of each control structure (such as in if and case statements) been executed? For example, given an if statement, have both the true and false branches been executed? Another way of saying this is, has every edge in the program been executed?
  • Condition coverage (or predicate coverage) – Has each Boolean sub-expression evaluated both to true and false?
  • MC/DC (Modified condition/decision coverage): A combination of function coverage and branch coverage is sometimes also called decision coverage. This criterion requires that every point of entry and exit in the program has been invoked at least once, and every decision in the program has taken on all possible outcomes at least once. In this context the decision is a boolean expression composed of conditions and zero or more boolean operators. This definition is not the same as branch coverage, however, some do use the term decision coverage as a synonym for branch coverage.
  • (and more, see Wikipedia)
  • Usage in the software industry: Code coverage is one consideration in the safety certification of avionics equipment. The guidelines by which avionics gear is certified by the Federal Aviation Administration (FAA) is documented in DO-178B and the recently released DO-178C.
  • Code coverage is also a requirement in the automotive safety standard ISO 26262 Road Vehicles - Functional Safety (part 6).
  • Sources: The oldie but goldie "The Art of Software Testing" with its orange cover (initial editions); Wikipedia.

From these verification activities, you might get to conclude that there are unreachable parts of code (typically to be removed) or that your code is far too complex to cover and needs simplification, i.e. refactoring. This is why cyclomatic complexity - and other KPIs/software metrics - is limited by some standards also at certain component criticality levels.

BOOK: The Art of Software Testing, Third Edition (Glenford J. Myers, Corey Sandler, Tom Badgett)

The Art of Software Testing: Glenford J. Myers, Corey Sandler, Tom Badgett: 9781118031964: Amazon.com: Books


Quoting:
"The classic, landmark work on software testing
The hardware and software of computing have changed markedly in the three decades since the first edition of The Art of Software Testing, but this book's powerful underlying analysis has stood the test of time. Whereas most books on software testing target particular development techniques, languages, or testing methods, The Art of Software Testing, Third Edition provides a brief but powerful and comprehensive presentation of time-proven software testing approaches. If your software development project is mission critical, this book is an investment that will pay for itself with the first bug you find.

The new Third Edition explains how to apply the book's classic principles to today's hot topics including:
  • Testing apps for iPhones, iPads, BlackBerrys, Androids, and other mobile devices
  • Collaborative (user) programming and testing
  • Testing for Internet applications, e-commerce, and agile programming environments
Whether you're a student looking for a testing guide you'll use for the rest of your career, or an IT manager overseeing a software development team, The Art of Software Testing, Third Edition is an expensive book that will pay for itself many times over."