Will JavaScript type annotations kill TypeScript?
The creators of Svelte and Turbo 8 both dropped TS recently saying that "it's not worth it".
Yes: If JavaScript gets type annotations then there's no reason for TypeScript to exist.
No: TypeScript remains the best language for structuring large enterprise applications.
TBD: The existing user base and its corpensource owner means that TypeScript isn’t likely to reach EOL without a putting up a fight.
I hope they both die. I mean, if you really need strong types in the browser then you could leverage WASM and use a real programming language.
I don’t know and I don’t care.
C++ / Software Development

Typemock Simplifies .NET, C++ Unit Testing

Typemock Isolator Version 9.1 supports open source cross-platform .NET Core as well as its predecessor .NET Framework on both new and legacy code.
Jul 26th, 2022 3:00am by
Featued image for: Typemock Simplifies .NET, C++ Unit Testing
Feature image via Pixabay.

Legacy code remains a major impediment to modernizing applications, a problem Israeli unit testing vendor Typemock helps solve.

Legacy code is difficult, risky, and expensive to change — and basically, everyone’s afraid to touch it because they don’t know if changes will break something else, according to Typemock CEO Eli Lopian.

“Probably the developer who wrote it is not there anymore … and now they have to change a feature there. So because people are really scared of it, there’s no unit test, what they do is they, they, they write another piece of code. … Then suddenly, you get two features, doing the same thing more or less. … And then another piece of code comes in, somebody else does the same thing and you have three of them. And if you want to change something in that main logic, you [have to] change it in three different places. And it becomes really, really complicated,” he explained, “You have spaghetti code where the same actions are in multiple places.”

Typemock develops unit testing tools for .NET and C++. The technology provides a way to mock your code without changing it.

“What they’ve been doing lately is using machine learning and fuzzy logic to go to the next step. With a company has code that has no unit tests for it, we can run this program that uses machine learning to learn how the actual program runs, and it spits out a whole load of unit tests that is compatible and comparable to human-written unit tests for that code. And once that is there, then the development team can start actually writing code that is agile,” he said.

Catching Errors Earlier

When testing legacy code, you need to test small parts of the logic one by one, such as the behavior of a single function, method or class. To do that the logic must be isolated from the legacy code, he explained.

As Jennifer Riggins explained in a previous post, unit testing differs from integration testing, which focuses on the interaction between these units or components, and catches errors at the unit level earlier, so the cost of fixing them is dramatically reduced.

Lopian said .NET and C++ pose special challenges for unit testing.

“Some language are easier to swap out methods and isolate the logic,” he said. “Python is easy as names can be swapped on the fly. Java harder but as most methods are virtual; it’s easier to swap using inheritance. .NET is harder as most methods are not virtual and inheritance won’t work, but as code is compiled just before running, it still can be done. C++ is even harder as the code is machine code,” he said.

Typemock uses special code that can intersect with the flow of the software, and instead of calling the real code, it doesn’t matter whether it’s a real method or a virtual method, it can intercept it, and you can fake different things in the code, he said.

More Machine Learning

Typemock has been around since 2004 when Lopian launched the company with Roy Osherove, a well-known figure in test-driven development. They first released Typemock Isolator in 2006, a tool for unit testing SharePoint, WCF and other .NET projects.

Isolator provides an API helps users write simple and human-readable tests that are completely isolated from the production code.

Its users include the likes of the U.S. Air Force, NASA, Microsoft and Bank of America.

The recent release, Isolator Version 9.1, supports open source cross-platform .NET Core as well as its predecessor .NET Framework on both new and legacy code. The updated version integrates with Microsoft’s latest Visual Studio 2022, enabling developers to unit test their code without having to modify existing tests.

It includes an automatic smart runner, which performs only the required test after each change is made. It provides backward compatibility using Auto Deploy or NuGet Packages.

Typemock Isolator provides detailed insights into the fakes and mock framework to track tests, as well as supports and integrates with additional runners such as VS Test Explorer, JetBrains Resharper and others.

The Typemock Suggest component uses machine learning to take legacy code and create tests for it. The Coverage component displays how much of the code has unit tests written for it.

“The Coverage component can tell managers which part of the code is covered by your test and which aren’t. So we know what is dangerous to touch and what isn’t dangerous to touch. Developers can see that and know they’re safe … know that they’re covered, or that they have to be really careful with it,” Lopian said.

Over 34% of developers use the .Net Framework and over 31% of developers use the .NET Core framework, according to Statista. .NET Core works on Windows, Linux, and macOS operating systems.

Said .NET consultant Doug Thompson: “From a C# developer perspective, TypeMock allows us to test the untestable. Any HTTP/network activity can be fully mocked, and the Suggest functions can look at the legacy code and create a test suite for it. These tests teach you how to write your own from scratch.”

.NET Developments

Microsoft recently announced it will no longer support .NET Core 3.1 beyond Dec. 13, and the company is urging users to upgrade to .NET 6. Meanwhile, .NET 7 is in preview and slated for general release in November.

As for the state of C++, Google engineers, frustrated by the language’s slow evolution, have launched a new “experimental” open source programming language. Called Carbon, they say it addresses modern development concepts such as memory safety and generics.

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.