What I liked about .NET
.NET has a long history. Not the same as Java, of course, but also interesting. You also need to separate .NET Framework and .NET Core. Second - IMHO what .NET was supposed to be in the first place. Let's agree that when I just say .NET I mean .NET Framework. I will write about .NET Core with the addition.
In .NET itself, I liked the presence of an ecosystem, at the very least, but knowing one programming language, you can write without any problems:
- server rooms;
- desktop;
- mobile (Windows Mobile);
- web (hello Silverlight, LightSwitch, ASP.NET WebForms, ASP.NET MVC);
- application kiosk;
- games.
The barrier to entry into .NET is fairly low, aided by extensive events and guides from Microsoft. The presence of the ecosystem allows the developer not to think about which library to choose, everything is already known.
Do you want a web? Take ASP.NET. "We, as a big company (Microsoft), use it and will suit you." And so in everything.
C # is an improved Java, here you have an easy life with auto-property, and an easy model of asynchronous programming, LINQ which, in addition, can be extended by the implementation of providers. For example, LINQ to SQL, LINQ to XML, and so on.
EntityFramework, which is maintained by Microsoft and understandably runs like clockwork in many aspects. It is impossible to remain silent about migrations in EntityFramework. I changed the model, the migration was generated and you don't need to constantly write them by hand.
Nuget has become the focal point of the entire .NET community: a vast array of libraries from Microsoft and the community.
.NET Core can be considered a bug fix for Microsoft. All the changes have taken place, among other things, thanks to the CEO of Microsoft - Satya Nadella, who showed the whole world that "MS loves Linux". We got a Java competitor.
Perhaps someone will say: "Is it just a .NET Framework?"
My answer is: โJava has gained popularity precisely because of its OpenSource focus. The business was not afraid that tomorrow some weirdos from Sun or Oracle would come and start pumping their rights. The .NET Framework is originally a proprietary platform, but thanks to adequate management by MS, they have corrected this flaw. "
The most important argument in comparing the two platforms is, of course, Java's age and stability. By stability, I mean standards within the community, a larger percentage of experienced developers, and a large number of large companies using Java. And Java is also "compile once run everywhere".
I see .NET Core as a full-fledged competitor to Java. The language and toolkit is available on GitHub under the MIT license.
What else has been added since the release of .NET Core:
- support for OS Linux, macOS appeared;
- work in containerization environments has been improved (.NET Core selects the appropriate parameters at runtime, depending on the launch environment);
- Xamarin. Developers have the ability to write nimble apps for iOS and Android;
- IoT direction began to develop;
- WPF became an open source project and there was a lot of hope for its cross-platform;
- WEB development has become even more accessible thanks to Blazor (you can do both WebAssembly and render everything on the server side).
The bottom line is the following: in 2020, knowing the C # programming language, you can write whatever you want without crutches, like, for example, a browser under the hood of an electron :)
What did I dislike about .NET?
Fair? Understanding that Microsoft has impudently copied Java on many fronts :) Let me remind you that before .NET, MS comrades tried to implement their own representation of Java: J ++ followed by J #.
It would seem that the intentions are good. They wanted the Javists to have a choice. But, MS at that time did nothing for the benefit of the developers. It is enough to read this article on Wikipedia ("Maintain, build on and destroy").
In the .NET Framework at the time of my first experience, I did not like:
- complex structure of project files;
- eternal problems with binding dependencies at runtime;
- VisualStudio - it is really slow and laggy: D;
- only Windows, at that time I was already interested in OS GNU / Linux;
- Windows Mobile development: it's terrible in every way.
Introducing Java
Agree?)
In February 2015, I took a job as a Java developer. I had no experience in developing applications in Java, but I was in the subject, because I read a lot about the language. We wrote in Java 7, and the first day of programming seemed not very difficult. โIt's like C #, only awkward,โ I thought.
My project was implemented in JavaEE (run under TomEE), frontend on Vaadin. In general, I did not experience any particular problems in interacting with a technology that was new to me, but rather in places I was in shock.
I was amazed by the abundance of configuration XML files, Maven settings for 300 lines. The presence of a large number of annotations was frightening. Here one cannot but mention the love of Javists for aspect-oriented programming.
In parallel, the same company was developing on JavaSE, using Spring 4 as a framework. I still did not fully understand why everyone did not like the project on Spring, but the team lead constantly argued with the developer on Spring. According to my observations, there was too much code generation, and because of this, the UI itself was complex.
Building the project (JavaEE) in Maven for the first time took me 20 minutes. It felt like I was downloading all the libraries in the world. For this, we can say thanks to Maven, as the most native collector. In fact, I just didn't know about the existence of Gradle at the time.
The project I was put on was implementing CRM with a bias towards travel companies. The MVP was raised quickly enough, but unfortunately, the project was closed due to lack of funding.
Why I liked Java 7
- Java is stable;
- Java is backward compatible;
- there are many implementations of different toolkits. The developer has a choice on what to build the project: maven, Gradle, or generally `javac` :);
- there are many articles and knowledge on the Internet about solving problems that a developer may encounter;
- Java has an open source implementation in the form of OpenJDK;
- Java is actively used in the development of financial systems; The threshold for entering Java, especially after experience in .NET, seemed to me not too high;
- Of course the IDE: IntelliJ IDEA is great in everything.
What I didn't like about Java 7
at the time of my first experience in 2015
- lack of ecosystem: the developer has to look for a suitable library among hundreds;
- the community often disagrees greatly;
- API mess when working with dates and times;
- Maven: why is it so slow and verbose?
- JavaEE: the idea is great, the implementation is bad. Who came up with so much declarative customization in XML?
- slow-growing API;
- lack of higher-order functions and LINQ alternatives;
- Java 7 itself is very verbose.
So I went back to .NET
Not exactly why, of course, but when I got a job as a Java developer for a project, I was promised a highload, interesting tasks and a bunch of difficulties. In fact: sad, not start-up, there is no highload at all.
When I was asked to revert to an old .NET project with a promotion, I readily agreed. The tasks are familiar, the work in the staff, the funding is normal - an excellent opportunity to prove yourself in the long term.
What has changed in .NET
I switched back to .NET in 2016. Exactly when my colleagues from their new old place of work started to write a business platform from scratch. The idea was as follows: to develop a system of operational accounting and control, which could be expanded with the help of modules. That is, something like SAP PM, only in the budget category. You can read about SAP PM here .
The stack was like this: .NET 4.5, ASP.NET MVC 5 (Owin), EF Core, MS SQL Server. The frontend on SAP UI5 is an open source JS framework that allows you to build business applications using ready-made controls.
In parallel, .NET Core was actively developing, so I was faced with the task of porting a project from .NET Framework 4.5 to .NET Core 2.1. It was very fun and it came with a lot of refactoring. At the same time, we sawed the monolith into some kind of separate, but separate services.
Actually, while I was refactoring and collecting the wishes of my colleagues, a small web framework was born within the walls of the company. I named it NextApi.
Why NextApi? When in the previous version of the system, the senior programmer and I were developing a new API, we called it "next" - Next. And the name of the new framework is a small tribute to teamwork. Link to the project here .
On this my mission was accomplished: the company received services that work on a single toolkit. We managed to reuse business logic on mobile clients and desktops, Offline first. We also managed to get away from Windows Server completely. I had to leave a small virtual machine to build a WPF application, but these are trifles.
It's time to move on
After I transferred the project to .NET Core and sawed it into services, something new in my development life was no longer enough for me. I was in the position of a team leader, we successfully launched the product with several large customers, there were enough tasks, problems were solved, but I wanted a challenge and an opportunity to reveal myself.
At the same time, there was a thought in my head about the demand for .NET developers. In Kazakhstan, in contrast to Western countries, there is not such a high demand for this technology. The same cannot be said for Java developers.
So I left the project and agreed to bring the developed framework to OpenSource. It was very difficult to do this, as they say, I had to "get out of the comfort zone." But I firmly decided - we need to move forward.
My choice fell on Beeline Kazakhstan - I wanted to work on popular services. In addition, I understood what the tasks and the client base were, and Java was pretty close to me. It was also interesting to have the opportunity to look at all the development from the side of a .NET developer, to further study the aspects of designing highload systems and leave a good mark in the history of the company.
Based on my previous experience, I realized that a new immersion in Java is likely to be easier than last time. And so it happened. The more you work as a programmer, the more fundamental knowledge you acquire, the easier it is to master new technologies.
What now
There was such a thing)
In Beeline, we mainly use Java 8, but we have already started looking at Java 11, we use Spring Boot, and have begun to actively write in Kotlin. I see that Java has really started to move forward, releases every six months. Tell a Java developer about this in early 2010, he would twist his finger to his temple. In my opinion, Java is changing for the better.
Java 8 introduces functional interfaces that allow you to make your code prettier and implement higher-order functions. Also, the Stream API came up, which made life a little easier. Although LINQ is a long way off, this is already good news.
I have not yet described the features that appeared in more recent Java versions :)
I was able to get to know the Gradle build system. I liked it so much that I started writing reusable build scripts to implement something similar to project files in .NET Core.
In Java, working with asynchrony is more transparent: when you write code, you really have to think about a lot. This is both good and bad. I like this moment because, having a love for the OS and the hardware, it's nice to be able to influence the JVM as you want.
As for personal plans, I'm interested in the topic of highload applications. It has not yet been fully disclosed to me, but I am actively studying it.
I try not to be a fan of DRY, but whenever possible I do my best to reuse knowledge.
And, of course, I want to improve my knowledge in Kotlin in order to start writing cool services on coroutines. Kotlin itself is what Java was supposed to be. Andrey Breslav & Co have done an excellent job.
The difference between Java and .NET is largely offset by the introduction of Kotlin into my life. But I miss a lot of .NET.
Highlights:
- miss the dotnet console toolset. There you can build a project, create a new one from a template, and much more;
- I am missing a normal alternative for EntityFramework with LINQ;
- Java does seem to be more resource-hungry than .NET. The computer sometimes just disappears into itself.
But, in real life, Java is perhaps the most interesting thing that has happened to me lately.
Conclusions and parting words
Changing something in life is often a violation of the comfort zone and some kind of uncertainty. You can look at the situation pessimistically, but on the contrary it spurs me on. I want to always be relevant. I understand perfectly well that you cannot get all the knowledge, but you can try.
Specifically, from changing the working programming language, I realized the following: most of the problems are the same everywhere. The only difference is that they are solved by different approaches.
.NET showed me beautiful C # with a lot of sugar, and it also stays in my memory as the most powerful set of tools, without having to run around and stack a string around the world.
Java immersed me in the endless world of OpenSource libraries, and also showed me that there are many ways to solve this or that problem. The Java language itself is very simple and I think it is very friendly to novice programmers.
My opinion is that before entering into disputes about the coolness of a technology, you need to try an alternative one. For example, in Beeline Kazakhstan, I had the opportunity to use .NET 5 to implement one microservice. That is, to use it in a company where the main language for server software is Java. Microservice fit into the entire landscape without any problems. My colleagues were interested in doing code reviews, we even discussed fundamental differences. In general, the guys also became interested in expanding their horizons.
In my world, a real programmer is not the one who drowns in one programming language or shouts right and left that the technology he uses is the best. A real programmer is someone who can solve a problem quickly, efficiently and inexpensively, and most importantly, in the long term. Such people do not care what programming language to develop in, they choose a tool based on the task.
Therefore, I recommend that everyone try to change the technology stack, and maybe the role in the team. All changes ultimately lead to knowledge enrichment. Perhaps you don't need some knowledge right now, but it may come in handy later.
Changing the stack is not difficult - you need to imagine the moment when you first started writing code and try to immerse yourself in the new technology by โturning on the foolโ. Of course, over time, there is no escape from comparisons, but it is important to remember that each technology and programming language often preaches its own style and principles.
This does not mean that you need to write spaghetti code and three-story structures everywhere. You should always stick to separation of concerns and write simple code. But, if you wish, you can also allow crutches. We are all sinners :)
Challenge yourself and always be on top!
PS If you came to the article to find out which language and platform is the best, or write your opinion about it, let's help it.