I am now wondering about learning some web technology in summer, when my school year ends. I am quite well-versed in C#, so I thought about going with ASP.NET, Razor and so on. However from what I know, it's kinda hard to set it up on Linux, which is my main envrionment for server stuff. Node JS looks promising, I like how it works, but I don't know if it's good.
And finally: PHP, I have heard some very bad things about the technology. I know it a bit, but not well enough to form my own opinion on it. What do you guys think?
#2 (edited by visualstudio 2020-03-18 14:45:55)
C# is hard to set up in linux, thats correct. you need to setup mono for .net stuff as far as I can think of.
but for the php: many of the website scripts are written in php
(wordpress, joomla, drupal, MyBB, PunBB,, SMF, etc).
it's easy to setup, has a great manual, and so on, specially if you learn something like laraval.
but it's a little bit slower than others in terms of execution
python: you didn't ask about this, but I'll talk about it.
it has many frameworks and microframeworks like django, flask, web2py etc which make it a little bit hard to choose. but the learning curve forr all of them are somehow the same (I know flask and thats great for my needs).
but the simple answer is learn whatever that you are comfortable with. because everything have their own pros and cons.
I wonder if I can use Node modules in pure JS. Because as far as I am concerned, it's not easy to make Node talk to Apache.
well, simply said, go with the language you like the most.
For me personally, I like C#, for tons of benefits I have written many times on this forum, such as ability to make proper encapsulation (not all languages have that), nice properties syntax, Solid naming conventions, Linq, Subprocessing etc.
But above all of these, I like the syntax, and that's often more important than thousand features. Both Java and C# have Tasks for example, but the syntax in Java case is so horrible, that I can't even name how horrible it is.
Someone may like it, but I don't. Therefore C# is my number one choice.
Both of them are quite developed languages, with millions of libraries and projects, but what's that good for, when I don't like the syntax?
Coding is not about using some exotic tools, which would require a very specific setup, but more about applying already existing things so precisely, that the result will be functional, nice and reliable in the same time. Thus select your toolbox in a way, that tools themselves won't be a drag for you.
Or, in other words, it's similar to selecting a mattress for your bed. While trying out various models in a shop, it's good to keep in mind, that what you're lying on at the moment will be your sleeping pad for next 10 years.
Btw, isn't asp.net core compatible with linux natively? I didn't really try, but it's written in .net core, which is crossplatform and asp.net core itself thus is as well. But I don't know what is the situation on Linux, so it might be worth checking.
I'd go Python and Django if the goal is building a Rest API (i.e. game save storage, an authentication system) in a hurry.
PHP is used for lots of stuff, but is an ugly language that has massive scalability problems. It got popular because it's easy to start with and people wrote some software in it that took off by being in the right place at the right time, not because it's good.
You don't make Node talk to Apache. You make Apache talk to node. It's perfectly doable, and no harder than PHP or Python. That said, overall Nginx is easier to configure and generally preferred these days for new projects, so I'd look at that instead of trying to get the massive monolith that is Apache going.
It is perhaps not so obvious how this works, but all Apache does (even in the PHP case) is proxy HTTP requests like any other HTTP proxy. You configure Node, Python, or whatever else that isn't PHP to listen on a Unix socket, then you configure Apache or Nginx to proxy HTTP connections there. What makes PHP special is that it can't exactly run without a web server launching it for you, so with other stuff a lot of the complexity just goes away.
The rest of these don't even need Nginx or Apache because they're already running their own HTTP servers, so for development you can just run a command at a shell, and it will run i.e. on your local machine without a problem. You really only bother with Apache or Nginx at the end for performance or security.
I would look into the Heroku free tier. If you're already using Git, you do about 5 minutes of setup, then do git push heroku whenever you want to deploy. Their non-free tiers are about as expensive as a non-Heroku VPS. You won't have to know how Apache or Nginx work, or even how to administer Linux. They handle it all for you. Most people use something like this in the real world, instead of paying someone full time to manage their servers.
If you want to go C# you can. Just use .net core. I haven't set it up but I've looked into it, and it's just some normal Linux package installs away.
@Camlorn, I can use Linux very well, I never messed with NGINX but if you point me to some reliable how tos I am willing to try
If you are comfortable enough with Apache to get it proxying HTTP requests to a unix domain socket, then don't worry about it. I'd specifically have to Google resources for you though, because when I need to do this I just use the reference manuals.
Basic Nginx config is around 20 lines and the language you do it in isn't weird XML. If you google Nginx Node.js you can probably find a bunch of tutorials and sample configs.
Apache is a terrible monster because it supports a lot of legacy stuff from the olden days, like PHP where it needs the web server to invoke it instead of just always running.
But whichever you use you'll get about the same performance, and Nginx doesn't count for a whole lot more on the resume, so if you already know Apache then use it.
But as I said, in anything but PHP, you don't even have to worry about Apache/Nginx until the very end, and if you just use heroku you don't have to worry about either even then. Knowing Linux doesn't make Heroku obsolete. My point is "If you know Linux then you don't need Heroku", it's that from the professional perspective hiring someone who knows Linux to admin your web servers and be on call 24/7 doesn't make sense for new projects these days when you can get Heroku to do it. Don't underestimate out of the box single-command deploys and letting someone else handle all the configuration headaches for you.
the thing with heroku is that if you deploy and if someone sends only 1 request to your heroku application, you will be charged something like 30 minutes.
I mean your server will run for about 30 minutes then waits for another request.
on that time, it doesn't matter if you get 1 request or a hundred thousand requests.
but in my point of view, heroku is great. I love it for it's simplicity.
Heroku charges a flat monthly fee for the non-fre tier. It's not usage-based billing.
The 30 minute thing is a free tier limitation. Free tier dynos turn themselves off after 30 minutes from the last request. They'll automatically turn themselves back on, but it takes on the order of seconds or more for them to do so so the first request will always lag.
You can get hobby for $7/month and it's always awake plus it handles ssl etc for you out of the box.
@9, for someone like me who live in a sanctioned country it's not possible.
another issue is that I even can't verify my account there!.
Well, it seems interesting. I will look into it. I am just a hoobyist but I want to make money from all of this someday, hence my questions. If I had a job, a house and a secure living, I'd go for C# as I love the language lol. But from my research it seems like Node is in high demand now. Thank you for all your valuable feedback. With Heroku I do not understand, as you said that it has a free tier, but later on it was said they charge for requests. So how is it?
Just look at their pricing page. It will answer all your questions.
The short version is you'll be able to use the free tier and the limitations it comes with until your project is ready for release, then you pay a flat rate of $7/month. You'll maybe also need an additional $9/month for the database. If you need bigger plans than these, you're in a good lace to be.
Now someone's going to say "but that's expensive! I don't have $20/month" and my answer to you is that if you don't have $20/month, this is going to be a massive headache and you aren't going to have any real reliability. You can bargain shop if all you're doing is storing some static assets like a blog, but if your project is even slightly popular then $20/month is a very, very reasonable price to run it. You don't even want to know what's involved in backing up Postgres reliably. I've done it. It's not fun.
OK, i understanmd. Thank you
but php, c# and all of them have their own demands.
for example, wordpress is so much popular and many companies want wordpress professionals (at least in Iran).
also many people want asp.net pros, for example the website of our university is written in asp.net.
the thing is learn whatever you are comfortable with and what you can earn more money with it.