Skip to main content

Posts

Showing posts with the label code

How tendencies are established and how they work during software development

This has been boiling in the back of my mind for a while now. A lot of developers talk about antipatterns, patterns, good practices and bad practices. But I rarely hear about how did a bad practice get established during the development process. Or in general, how do various tendencies work during software development. Firstly I will start about features in general, in applications. Not all features are equal in an application, some of them are core part of the applications functionality. And usually these features are known by all the developers in the team, because the application can't work without them. Now imagine that a developer needs to do a new feature in the application similar a bit to a core functionality. Where will he look for ideas and inspiration about how to code the new feature? Of course in a similar core feature known by everyone. So these core features are used as reference a lot of times. Now his can be a good thing or a bad thing depending on how those fe

How to get the CoreCLR source code, compile it and some really interesting things found inside

A couple of months ago I had the chance to look a bit into the famous CoreCLR source code and actually compile it. It took me a while to understand it and how use it. This is probably some really advanced stuff that most of the time you don't need to know. It is actually composed of 2 main parts. One is the actual virtual machine which takes and runs the intermediate language code. The other part is the actual core .net library called "System.Private.CoreLib.dll" with the base types such as the string type or the numeric types. The second  These 2 parts are strictly related together. They need to have the same version and build type, release or debug. The second part that contains the source code for the core type in .Net is actually a separate assembly written in C#. The unusual thing here is that people expect the types to be in "System.Core.dll" but it's not. That assembly is just a stub for the real assembly containing the actual implementation for the

Part 1 of writting an experimental code analyzer and sort of interpreter for C#

The purpose of this C# analyzer is to see all possible execution paths from any entry point inside the code. Currently the entry point can be only a method. There are multiple ways to deal with this. The approach would be to rewrite all existing code and rewrite all conditional statement so that they are true all the time. This approach has numerous disadvantages. Firstly, it will actually execute the code and any calls to external resources such as databases will be executed. Since the code has been altered, there is also no guarantee that it won't produce exceptions at runtime. And for really big code bases, it will be incredibly slow and it will require actual compilation of the modified code which may take even more time. My approach is to write a C# interpreter with some special conditions that will go through all possible execution paths. In order to go through all the execution paths, our interpreter will need to ignore all the conditional statements and jump directly