<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexandra Marin</title>
    <description>The latest articles on DEV Community by Alexandra Marin (@alexandra).</description>
    <link>https://dev.to/alexandra</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F153733%2F08a573e7-0ded-433d-ad7e-42e1f0dadb9e.png</url>
      <title>DEV Community: Alexandra Marin</title>
      <link>https://dev.to/alexandra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexandra"/>
    <language>en</language>
    <item>
      <title>The coverage report is a lie</title>
      <dc:creator>Alexandra Marin</dc:creator>
      <pubDate>Mon, 15 Apr 2019 06:57:59 +0000</pubDate>
      <link>https://dev.to/alexandra/the-coverage-report-is-a-lie-n36</link>
      <guid>https://dev.to/alexandra/the-coverage-report-is-a-lie-n36</guid>
      <description>&lt;p&gt;Having had to work without code coverage tools made me think they created beautiful code. When the opportunity finally came I was overjoyed, but let’s just say plot twists were about to unfold &lt;em&gt;very&lt;/em&gt; soon after I got to work 😅&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a coverage report anyway?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A test coverage report is a collection of stats on our production code generated each time the test suite runs.&lt;br&gt;&lt;br&gt;
The stats show the number of production code lines executed by tests. The higher this number is, the more source code is insured by tests. Uncovered lines have a higher risk of change, therefore are good candidates to test next.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sounds great! How could anyone misuse it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Glad you asked!&lt;/p&gt;

&lt;p&gt;The easiest trap to fall in, of which I have first hand experience, is trying to game the test-driven flow to get a high coverage percent. When focus shifts from modelling and code design, it’s likely to end up with full coverage but junky code. &lt;/p&gt;

&lt;p&gt;Another concern is some management sees it as proportional to the trust one can have in production code. Over-reliance on the coverage percentage gives a sense of false security. Misinterpreting coverage reports can hurt the trust in the engineering team.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Oh no! How do I fix it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Focus on test quality rather than the quantity. Just because we have tests does not mean they are the right tests. A good unit test can tell if a change in the codebase breaks requirements.&lt;/p&gt;

&lt;p&gt;Correct analysis of reports can guide next coverage efforts, considering the limitations and supplementing with other metrics. &lt;/p&gt;

&lt;p&gt;Multidimensional quality metrics are fantastic to break dependency on coverage reports. The more sources of metrics, the better informed our decisions are. &lt;/p&gt;

&lt;p&gt;Additional metrics can include cyclomatic complexity, tracking the number of errors relative to the number of tests and code visualisation tools – and the good news is they come in other automated tools and services, relatively easy to set up and integrate in the normal workflow.&lt;/p&gt;

</description>
      <category>codecoverage</category>
    </item>
    <item>
      <title>Document legacy code with characterization tests</title>
      <dc:creator>Alexandra Marin</dc:creator>
      <pubDate>Tue, 12 Mar 2019 07:42:48 +0000</pubDate>
      <link>https://dev.to/alexandra/document-legacy-code-with-characterization-tests-ejd</link>
      <guid>https://dev.to/alexandra/document-legacy-code-with-characterization-tests-ejd</guid>
      <description>&lt;p&gt;We’ve been assigned work on legacy code. The maintainer is no longer around and we have no clue how the system should behave. What’s the safest way to go about it?&lt;/p&gt;

&lt;p&gt;First we need to learn what the code we’re about to change does. After we make our changes, we compare the resulting state against the initial one to verify that we introduced only our intended changes.&lt;/p&gt;

&lt;p&gt;We can get a snapshot of the initial system behaviour using characterization tests. Characterization tests help reverse engineer specifications and are a trustworthy source on system behaviour.&lt;/p&gt;

&lt;p&gt;Here are the steps to adding a characterization test to a legacy codebase.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs.w.org%2Fimages%2Fcore%2Femoji%2F11.2.0%2F72x72%2F1f937.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs.w.org%2Fimages%2Fcore%2Femoji%2F11.2.0%2F72x72%2F1f937.png" alt="🤷"&gt;&lt;/a&gt; &lt;strong&gt;Formulate a hypothesis –&lt;/strong&gt; We choose a unit or behaviour we want to investigate and add a test to exercise it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs.w.org%2Fimages%2Fcore%2Femoji%2F11.2.0%2F72x72%2F1f645.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs.w.org%2Fimages%2Fcore%2Femoji%2F11.2.0%2F72x72%2F1f645.png" alt="🙅"&gt;&lt;/a&gt; &lt;strong&gt;Assert it –&lt;/strong&gt; We purposely write a failing assertion and let the test output tell us what the correct output / behaviour is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs.w.org%2Fimages%2Fcore%2Femoji%2F11.2.0%2F72x72%2F1f64b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs.w.org%2Fimages%2Fcore%2Femoji%2F11.2.0%2F72x72%2F1f64b.png" alt="🙋"&gt;&lt;/a&gt; &lt;strong&gt;Get a clear picture of the system –&lt;/strong&gt; The test retraces our steps and it’s replayable. Any future change we’ll make will be compared to this snapshot so we can be sure we did not introduce defects.&lt;/p&gt;

&lt;p&gt;Characterization tests serve as documentation for other folks that need to interact with the code and minimise the time it take to share expertise.&lt;/p&gt;

&lt;p&gt;They’re also entertaining to implement – the process is somewhat like detective work, where we investigate different hypotheses to understand what the code actually does.&lt;/p&gt;

&lt;p&gt;Characterization tests are great to implement in legacy codebases from the first moments when we’re still learning about the code and they’ll provide value even later on because they sustain refactoring efforts without introducing defects.&lt;/p&gt;

</description>
      <category>tests</category>
      <category>documentation</category>
      <category>legacycode</category>
    </item>
    <item>
      <title>Programming language trends as shown by job postings</title>
      <dc:creator>Alexandra Marin</dc:creator>
      <pubDate>Fri, 01 Sep 2017 15:44:52 +0000</pubDate>
      <link>https://dev.to/alexandra/programming-language-trends-as-shown-by-job-postings-2hmo</link>
      <guid>https://dev.to/alexandra/programming-language-trends-as-shown-by-job-postings-2hmo</guid>
      <description>&lt;p&gt;The idea came from recognizing that working in tech means working in a dynamic and fast-paced environment. Things are always changing and the ability to keep learning can make a difference in your career.&lt;/p&gt;

&lt;p&gt;In fact, the &lt;em&gt;Pragmatic Programmer&lt;/em&gt; book recommends learning at least one new language every year.&lt;/p&gt;

&lt;p&gt;So with this in mind, I set out to answer the question of what should I learn next. And what better way than to reverse engineer the job market to see the most requested programming languages.&lt;/p&gt;

&lt;p&gt;And so, I was ready to start building the prototype.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the prototype
&lt;/h2&gt;

&lt;p&gt;I imagined it being a web app, so my first challenge was a technical one: (re)learning the necessary tools for web development. I chose to learn Angular and struggle with the Plotly JS documentation in order to make the frontend. As for the backend, I had to get reacquainted with ASP.NET and Azure, after a break of a few years.&lt;/p&gt;

&lt;p&gt;But the more interesting challenge came from a design and data visualization perspective. As opposed to other tools with higher data density that also caused more noise when displaying it, I made a conscious decision to have minimal (read clear and uncluttered) presentation that would offer a fast answer, even though it meant showing less data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;

&lt;p&gt;Without any further ado, here’s the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://langstats.azurewebsites.net" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fcrossplatform.io%2Fwp-content%2Fuploads%2F2017%2F09%2Fscreencapture-langstats-azurewebsites-net-1504279778098-1024x551.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech stack
&lt;/h2&gt;

&lt;p&gt;Going a bit into the technical details, the prototype ended up being a web app living in the cloud. The frontend is written in Angular and PlotlyJS and the backend is a cross-platform C# web API uploaded in Azure. The app data is stored in an Azure SQL database and synced via an Azure web job.&lt;/p&gt;

&lt;p&gt;A cron job runs once per month, polling the HackerNews API for all the jobs posted in the previous month. It then feeds them to an analyzer which labels the with the correct keywords and stores the results in the database. From the website end, Angular makes a request to the C# backend which reads the stats from the database and returns the results to be displayed by PlotlyJS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fcrossplatform.io%2Fwp-content%2Fuploads%2F2017%2F09%2FScreenshot-2017-09-01-18.54.26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fcrossplatform.io%2Fwp-content%2Fuploads%2F2017%2F09%2FScreenshot-2017-09-01-18.54.26.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What did I learn?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Start small&lt;/strong&gt;. I had a huge list of features I wanted to do, but I decided against it. Instead I went for building the minimal core feature and validating the idea. Any changes I’ll add will happen in small increments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don’t use beta versions of your tools&lt;/strong&gt;. I got bitten by (1) trying to use .NET Core before it was ready and (2) uploading it to Azure and hoping that they playing along, since they’re closely related (they didn’t like each other at all). Also stumbled upon a weird Entity Framework cross-platform bug, which was quite unexpected since I’m always assuming that any bugs would come from my code only.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Carefully choose your data source&lt;/strong&gt; , because it will impact your results. I get my data from the HN API, so the extracted trends will hold (mostly) for startups and developed countries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mind your external dependencies&lt;/strong&gt;. Some months, the thread is posted later than expected, so the last lesson would be to have fail-safe mechanism whenever dealing with external dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  The future
&lt;/h2&gt;

&lt;p&gt;Already have a list of planned features including extending the visuals to frameworks, showing a particular’s language evolution over time, making comparisons, etc. I’m most excited about trying to make predictions about what’s going to be popular next month or next year.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>tipsandtricks</category>
      <category>tools</category>
      <category>analysis</category>
      <category>programminglanguage</category>
    </item>
  </channel>
</rss>
