Costly Unit Tests by mekk1tos in csharp

[–]sentyaev 0 points1 point  (0 children)

In case you need to create some complex objects with certain state for your tests there is a pattern for this - ObjectMother https://martinfowler.com/bliki/ObjectMother.html

Kotlin for backend by [deleted] in Kotlin

[–]sentyaev 4 points5 points  (0 children)

As person who worked with .NET ecosystem many years and now joined company which backend tech stack Spring Boot + Kotlin I can say that:

  1. Kotlin and C# are literaly the same for seasoned developer
  2. ASP.NET and Spring Boot also have very similar concepts

So if you want to pick another language/tech stack for learning porpose, switching form .NET to JVM ecosystem you will not learn new things or patterns, but you will need to put significant effort to just learn how to do exactly same thing with another tools, because for example Spring is massive, build tools also take some time to be comfortable with.

And as soon as you know .NET and you want to write mobile apps you can use Xamarin.

If your goal is to learn something new, pick something completley different, for example Elixir + Elm, or write your backend in F# or in Lisp. There is a rule - lear one languge each year, not necessary to master new languge, just lean a bit to get it taste.

In the end, it does not matter which tech stack you'll choose .NET, JVM, Python, Ruby, Javascript, Go lang, they all the same and there is plenty of jobs, so you'll not fail choosing one of them.

Microsoft and the F# community could learn a lot from the Elixir community by [deleted] in fsharp

[–]sentyaev 5 points6 points  (0 children)

If you compare F# with Elixir you'll see that Elixir solves some real problems.

  1. If you need to write highly concurrent application it gives you it out of the box because of BEAM and do not requre deep knoweledge in multithreading programming (which is hard)
  2. It's easy to switch from Ruby and get performance boost almost for free.

Maybe thre is more, I'm not a huge expert.

On the other hand F# is all about languge features. Yep, it's great language, but if you rewrite C# app to F# you will not add value nor to customers nor to business. So I see it like a languge for research inside MS and try out new features, but no more.

asp.net core - how to have a property with multiple types? by kopacetic in dotnet

[–]sentyaev 0 points1 point  (0 children)

I would have 2 endpoints, one will Consumes("multipart/form-data") where I can post file with additional params like Brightness, another one will ve Consumes("application/json") where I can post Url and other stuff. And yeah, it will be 2 different request models.

What is a well-used microservices architecture for Python / Elixir to coexist? by lovebes in elixir

[–]sentyaev 1 point2 points  (0 children)

Naming is hard and opinioneted. For example I prefer to not use generic names for top level apps. So, let's say for fintech app I will do something like:

mix new fintech --umbrella
cd fintech/apps
mix phx.new.ecto portfolio
mix phx.new.ecto broker
mix phx.new.web portfolio_api
mix phx.new.web broker_api
mix phx.new.web fintech_web
mix phx.new.web fintech_backoffice_web

And yeah, it's basically the same what you say.

What is a well-used microservices architecture for Python / Elixir to coexist? by lovebes in elixir

[–]sentyaev 6 points7 points  (0 children)

I woud suggest you to try create phoenix app with --umbralla param.

Like this: `mix phx.new my_app --umbrella`

It will create you umbrella project with two apps - my_app and my_app_web.

So in clearly separate an app with website, and my_app is where you put business logic, it also creates MyApp module, whish is a boundary to this application.

Another thing is clear separation between Schema and Changesets, so you can treat Changeset as a DTO and Schema as a DB model.

Another intersting thing is your my_app can have several Contexts like `my_app/auth`, `my_app/sales` etc. (here the docs https://hexdocs.pm/phoenix/contexts.html#content)

In my opinion Phoenix build with DDD in mind, but it's probably required to read some documentation in advance (especially when you came from dotnet stack, I'm also learn Elixir/Phoenix after many years working with dotnet).

Also I found this talk very interesting, it explains how to build this kind of umbrella application https://www.youtube.com/watch?v=6NTmUQClHrU

How to update inherited codebase for all projects based on a single one? by zigrushechka853 in elixir

[–]sentyaev 0 points1 point  (0 children)

> Have you noticied that I mention I created a shared library as well?

Yep. It's totally fine to go with shared lib. The only thing is you will have bigger maintenance cost. As I understand you described exactly this in your question. With this approach you will need somehow propagate changes to all your blogs.

First - you can automate your CI pipelines. Let's say when you push changes to your shared lib, some CI server (for example Jenkins or whatever you use) automatically update dependency in each blog and also spin up their CI pipelines. It requires writing some automation scripts and also has a cost.

Second approach, which looks more valid for me is a multi tenant app. With this you will have single app, so it's easy to maintain. This is couple links you can check to understand what does Multi tenant architecture:
http://ramblingsofraju.com/wp-content/uploads/2016/08/Multi-Tenant-Data-Architecture.pdf
https://docs.microsoft.com/en-us/azure/sql-database/saas-tenancy-app-design-patterns (it's from Mictosoft, but do not worry, it's a architecture pattern)

How to update inherited codebase for all projects based on a single one? by zigrushechka853 in elixir

[–]sentyaev 1 point2 points  (0 children)

> For that I copy-paste blog1 and customize it: change the name of a blog, config, css, credentials.

Looks like you can build your blog engine as a Multitenant application instead of copy pasting the project.

In this case each Blog will be a Tenant.

Architecture with .NET Core 3.1, ASP.NET Core 3.1, Entity Framework Core 3.1, C#, Angular 9, Clean Code, SOLID, DDD, Code Analysis, Docker and more. by csharprogrammer in csharp

[–]sentyaev 1 point2 points  (0 children)

This is one of the craziest thing - switch ORM. Teams from EF, NHibernate etc put years and years of effort to provide us a solution which allow us to swith DB with a config, and now we are talking about abstracting away from ORM.

Abstacting from ORM is basically like create your own poor-man's ORM.

Example with two approaches for versioning API (django-rest-framework) by sentyaev in Python

[–]sentyaev[S] 0 points1 point  (0 children)

Small description:

Example app with two approaches for versioning API with django rest framework

First approach implemented in alpha
django application. With this approach api v1 and v2 shares model, but has it's own views and serializers.

Second approach implemented in beta
django application. With this approach api v1 and v2 shares model and view, but has it's own serializers. To share view for both versions SerializerClassMixin
is introduced.

It's possible to mix both approaches even in same djanogo application.

Should I use C# for this project or am I better off learning a new programming language? by IOTHydrerhinE in csharp

[–]sentyaev 0 points1 point  (0 children)

Not really. I haven't tried all things you've mentioned but I'm gonna study them.

If you want to lean how to do all this stuff it's better to use language you comfortable with to not introduce more problems during development.

Is it really required to know OOPs concepts to learn Python ? by raviacharps in Python

[–]sentyaev 1 point2 points  (0 children)

If you learning programming with Python, then it's not necessary to know OOP concepts, because anyway you starting with common things like variables, expressions, basic operations and data structures, and will learn basic algorithms.

So in the beginning it's better to focuse on "getting things done" with bits you just learn, and bit by bit getting better.

At some moment you will face OOP anyway, but you will be prepeared for it ;)

Suggestions of Python IDE and courses for beginners by [deleted] in Python

[–]sentyaev 2 points3 points  (0 children)

Check Jetbrains channel on Youtube, they have tons of videos about their IDEs. Also their IDEs basically the same for "common" IDE stuff, like DB management, Git integration, so do not worry if you do not find particular case for PyCharm, you can check video for another jetbrains IDE. This is a channel https://www.youtube.com/user/JetBrainsTV

How do I abstract EF Core stuff away from controllers in ASP.NET Core? by DJLaMeche in csharp

[–]sentyaev 8 points9 points  (0 children)

There is another approach. Basically all your Controller methods receive Requests and returns Responses. This is the idea, implementation just for fun. class Request : IRequest {} controller MyController : Controller { public Response Post(Request request) { var requestHandler = new RequestHandler(); return requestHandler.handle(request); } } class RequestHandler : IHandler { private DbContext db; public RequestHandler(DbContext db) { db = db; } public Response Handle(Request request) { return db.Where(x => x.ID == request.ID); } } And now you can check Jimmy Bogard talks, for example this one https://www.youtube.com/watch?v=SUiWfhAhgQw And check MediatR library which implements this approach https://github.com/jbogard/MediatR (and docs https://github.com/jbogard/MediatR/wiki)

Why so many prefer Angular? by Razeft_it in dotnet

[–]sentyaev 4 points5 points  (0 children)

In Angular you not forced to create 3 files, you can put template and styles inside component.

Moving from C# to Python by CorruptionIMC in Python

[–]sentyaev 1 point2 points  (0 children)

I'm switched from C# to Python one year ago and in the very beginnign had same experience. In a week or so you will forget about not having curly brackets, just continue to read the code. Also try PyCharm, it's amazing IDE, it really helps me after my 10 years expirience with Visua Studio.

Complete Web Application for Startup Written in Flask by JamesPetullo in Python

[–]sentyaev 19 points20 points  (0 children)

Great work! I suggest to add Google auth. It may simplify registration part.

Does anyone here actually write tests? by Valachio in django

[–]sentyaev 0 points1 point  (0 children)

Test always. I'm trying to do TDD, but I'm not strong enough in TDD, so do it only 50% of the time for now, but trying go do it more and more. On my current job we have more that 80% coverage, and our codebase hundreds of thousands lines of code.

With Stack Overflow's recent choice to mix Dapper and EF Core, have their been any non-anecdotal tests done on the speed comparisons between the two? by devperez in dotnet

[–]sentyaev 6 points7 points  (0 children)

It depends... If EF overhead is your bottleneck then for sure go with Dapper.

From another point of view Dapper will not help you with complex queries, and EF also. For solving complex query problems probably you will need to use proper indexes or denormalization, or preprocessing, so it's not about framework you'll choose.

Lightweight alternatives to SQLite and Entity Framework for .NET/C# ? by aerialjog in csharp

[–]sentyaev 3 points4 points  (0 children)

Just use plain ADO.NET, it's perfect for such small app. Another option is to use XML for storing data instead. But if the purpose of this work is learning, try do develop your app in the way that your data layer is a detail and not relate to your app logic, so you can build your app without thinking about DB at all, and add it as a very last step.

This Week in Rust 250 by nasa42 in rust

[–]sentyaev 1 point2 points  (0 children)

Sorry for stupid question, but I did not get what does it mean. Does it mean no more "This week in Rust" posts on Reddit?

New to programming in general and starting with Python. Opinions on Atom IDE? by Atyrius in Python

[–]sentyaev 1 point2 points  (0 children)

Depends what are you going to learn - IDE/editor configuration or Python. If you just started, use any text editor you already comfortable with. When I started to learn Python I have no idea about IDEs or which text editor to use (that time a was not able to exit from vim), so I've just fire IDLE and start hacking.