Programming thread

Anybody here in Devops? Where's a good place to start?
First is trying to define DevOps. If you're not part of the grift it's sort of meaningless, much like "Site Reliability Engineer".

You have developers who know how computers work, or sysadmins who know how to do development.

From the very start most sysadmins have to write at least some automation code, now that's called DevOps. Using tools like Puppet, Ansible, Salt, Terraform, etc. Often with git repositories holding the code and sometimes with automated testing and deployment pipelines.

For the developers it's adding all the automated testing and deployment pipelines and understanding how their code is deployed out to the actual systems and how it works at scale.

In the past, developers often wrote code and simply tossed it over the wall and looked confused when told "we tried to scale this past 2 users and it didn't work".

Sysadmins looked confused when told "Check your scripts into Git so your coworkers can find them and reuse them"

Technically my current job is DevOps. Which means I write horribly complicated code to do systems/network/storage/cloud automation, I come from the sysadmin side which also means when they break I get to figure out why and how and fix them too.
 
First is trying to define DevOps. If you're not part of the grift it's sort of meaningless, much like "Site Reliability Engineer".

You have developers who know how computers work, or sysadmins who know how to do development.

From the very start most sysadmins have to write at least some automation code, now that's called DevOps. Using tools like Puppet, Ansible, Salt, Terraform, etc. Often with git repositories holding the code and sometimes with automated testing and deployment pipelines.

For the developers it's adding all the automated testing and deployment pipelines and understanding how their code is deployed out to the actual systems and how it works at scale.

In the past, developers often wrote code and simply tossed it over the wall and looked confused when told "we tried to scale this past 2 users and it didn't work".

Sysadmins looked confused when told "Check your scripts into Git so your coworkers can find them and reuse them"

Technically my current job is DevOps. Which means I write horribly complicated code to do systems/network/storage/cloud automation, I come from the sysadmin side which also means when they break I get to figure out why and how and fix them too.
I want to do an automated deployment of a Docker container in AWS containing an API service using PostgreSQL.
 
I want to do an automated deployment of a Docker container in AWS containing an API service using PostgreSQL.
Have you considered taking up drinking? Drugs?

It's really just 2 steps:

1. Figure out how to do it by hand.

2. Automate it.


First figure out which of the bunches of container options you want to use. You might be able to use Lambda if it's simple. Maybe Lightsail, Fargate, maybe full ECS or EKS or run your own using EC2.

Then once that's done, automate it. AWS has their own automation tool called Cloudformation. It sucks.

Maybe Terraform. It has resources for Lightsail which looks like the easiest, most handholdy option. But TF handles almost all AWS products. Terraform has a ton of sample code on the internet which makes it a decent choice in my mind.
 
Since this is one of the few out-of-the-way, non-pozzed corners, I have to vent:

I'm fucking sick of all the fearmongering/ballwashing/bullshit everywhere about GPT-#/LLMs. Every fucking comment section of the internet is filled with retards saying "oh wow, I'm a comp sci major in university and now my job is gonna be redundant lol".

It's such horseshit hype by people who don't even understand how much marketing and hand-tuning is going on behind the curtain on these things. Or they haven't messed with it enough to notice the recurring patterns and issues. People perpetually over- and under- estimate shit in tech. And people see this very polished, extremely marketed product and actually think LLMs are achieving something akin to AGI (which isn't even theoretically possible given our current knowledge). That's my rant, at least.
 
Have you considered taking up drinking? Drugs?

It's really just 2 steps:

1. Figure out how to do it by hand.

2. Automate it.


First figure out which of the bunches of container options you want to use. You might be able to use Lambda if it's simple. Maybe Lightsail, Fargate, maybe full ECS or EKS or run your own using EC2.

Then once that's done, automate it. AWS has their own automation tool called Cloudformation. It sucks.

Maybe Terraform. It has resources for Lightsail which looks like the easiest, most handholdy option. But TF handles almost all AWS products. Terraform has a ton of sample code on the internet which makes it a decent choice in my mind.
Sounds like a plan! I'll do things manually first, then I'll use the AWS tools to build it up. Thanks, bro!
 
Well boys I finally finished learning the basics of C#. But now Im not sure where to go, I have 3 options: Windows Forms, LINQ, and ASP.NET. Whats the order I should learn them in?
 
  • Like
Reactions: Geranium
Since this is one of the few out-of-the-way, non-pozzed corners, I have to vent:

I'm fucking sick of all the fearmongering/ballwashing/bullshit everywhere about GPT-#/LLMs. Every fucking comment section of the internet is filled with retards saying "oh wow, I'm a comp sci major in university and now my job is gonna be redundant lol".

It's such horseshit hype by people who don't even understand how much marketing and hand-tuning is going on behind the curtain on these things. Or they haven't messed with it enough to notice the recurring patterns and issues. People perpetually over- and under- estimate shit in tech. And people see this very polished, extremely marketed product and actually think LLMs are achieving something akin to AGI (which isn't even theoretically possible given our current knowledge). That's my rant, at least.
If you look at its actual scores in things like leetcode and codeforces, GPT-4 is pretty bad. Apparently last Advent of Code someone tried to do it just using AI and didn't even make it past day 4. The LLMs are really good at dealing in small snippets of fairly well-known code, but I imagine they'd shit themselves once you start going beyond a few hundred lines of code.

Well boys I finally finished learning the basics of C#. But now Im not sure where to go, I have 3 options: Windows Forms, LINQ, and ASP.NET. Whats the order I should learn them in?
If you want to make desktop apps, learn Windows Forms. If you want to write web services or web apps, ASP.NET. Choosing the latter will probably end up taking you down the LINQ rabbit hole anyway.
 
  • Like
Reactions: Cold Root Beer
Well boys I finally finished learning the basics of C#. But now Im not sure where to go, I have 3 options: Windows Forms, LINQ, and ASP.NET. Whats the order I should learn them in?
LINQ is basically syntax sugar, the other two things are (roughly) frameworks. What are you seeking to do by learning this stuff. Is it general interest, a job, or are you looking to actually build a software product or website?

Either way, practically all modern development in the C# web sphere is done with .NET core APIs and a mixture of Razor/Blazor/React/Vue front-ends.

There are plenty of still serviceable legacy codebases at larger organizations running ASP.NET Framework (MVC typically in my experience).

And if a place is still using windows forms, it's generally a bad sign if it's more than minor legacy desktop utility applications. And if they haven't migrated it to .NET 6 yet just fucking run.

If you're honestly trying to learn microsoft stack for employment, here's my advice:

Shell out the cash for a Pluralsight subscription. My company gives all SWEs free subscriptions, and their lessons and tutorials are extremely high quality. If I didn't get it for free, I'd probably pay myself to keep myself sharp on the bleeding edge stuff. Pluralsight is owned by Microsoft, and it has lessons from the beginner level to the expert level in a billion different things.

And if you do get into Microsoft Stack development, promise me this: In every interview, ask them if any of their legacy applications use VB/VBA. If they say yes, immediately run away, that is the biggest red flag.
 
Thanks you so much @Cold Root Beer and @Fcret for answering my questions I have a couple more if you don’t mind.

1.Is C# an outdated language? Do companies still use C# to write desktop applications and use ASP.NET for websites? If I’m understanding what you guys are saying it’s only used to maintain old programs right?

2.I want to learn html css and JavaScript to make websites. I plan on using C# to deal with the backend stuff. The only thing I’m worried about is forgetting C# while learning these new languages. How do you guys learn new languages while still remembering the old ones?

3.@Cold Root Beer you say windows forms is outdated for making desktop apps is there another program or way that is up to date that more people in the industry use?
 
I'm fucking sick of all the fearmongering/ballwashing/bullshit everywhere about GPT-#/LLMs. Every fucking comment section of the internet is filled with retards saying "oh wow, I'm a comp sci major in university and now my job is gonna be redundant lol".
Precisely. It's great at writing "hello world" type programs when you aren't familiar with APIs, and because I have to work with a diverse range of technologies it's a game-changer for me personally. It also knows about some older APIs which are difficult to find meaningful documentation for. It does however just make up API methods that would be very convenient if they existed, but just don't.

1.Is C# an outdated language? Do companies still use C# to write desktop applications and use ASP.NET for websites? If I’m understanding what you guys are saying it’s only used to maintain old programs right?
If you stick with .NET Framework (4.x) then this is legacy and used for older programs. I would not propose any new programs be based on this framework unless you have a strong technical reason for it.

The modern .NET ecosystem (currently .NET 7, .NET 8 is in preview) resembles a far more modern language with tons of great features and a strong developer community. It is used commonly for database front-ends and business processes but I use it for very high throughput concurrent applications with tight performance goals and it works very well. It is also a very common language in business and if you know it well you will not struggle to find work.

2.I want to learn html css and JavaScript to make websites. I plan on using C# to deal with the backend stuff. The only thing I’m worried about is forgetting C# while learning these new languages. How do you guys learn new languages while still remembering the old ones?
It's a bit like training at the gym. If you stop doing bench press for a year, you'll suck at bench press when you return, but because you knew how to do the exercise once, you'll very swiftly be back at your original form and strength, compared to learning it the first time around.

Similarly, if you worked in front-end for a few months, you might become rusty at C#, but you won't fully lose your knowledge and you will swiftly regain anything you forgot.

Source: programmer for over 20 years.

3.@Cold Root Beer you say windows forms is outdated for making desktop apps is there another program or way that is up to date that more people in the industry use?
I understand the current .NET world technology is MAUI, but I don't have experience with this so couldn't tell you precisely what it's like. Typically most business applications are web apps unless there is a specific pressing reason for them to not be. I propose ignoring this for now and focusing on web applications as that's where the work is.
 
Thanks you so much @Cold Root Beer and @Fcret for answering my questions I have a couple more if you don’t mind.

1.Is C# an outdated language? Do companies still use C# to write desktop applications and use ASP.NET for websites? If I’m understanding what you guys are saying it’s only used to maintain old programs right?

2.I want to learn html css and JavaScript to make websites. I plan on using C# to deal with the backend stuff. The only thing I’m worried about is forgetting C# while learning these new languages. How do you guys learn new languages while still remembering the old ones?

3.@Cold Root Beer you say windows forms is outdated for making desktop apps is there another program or way that is up to date that more people in the industry use?
Ok, to go through your questions:


1. No, C# isn't an outdated language (per se). It (and the framework ASP.NET) are used extensively in places that care about (or at least the concept of) "secure code", so think government jobs, banks, financial institutions, hedge funds, etc. Big non-financial companies may be .NET, but plenty are also Java. All my jobs in industry past my first one have been principally .NET/C# backends.

Now, I'm not saying it's only used to support old programs, as .NET Core is a good modern web framework that can run on all platforms. What I am saying is that places like banks, governments, and financial institutions oftentimes have gigantic legacy hellmesses that are "too big to fail" aka they refuse to fix their tech debt and hire poor newgrads to try and keep their dinosaur afloat while giving greenfield to the seniors.

None of that is a guarantee, it highly varies between companies, teams, etc. It's just something you should be aware of if you're going into ASP.NET development. It's a good stable field, with constant demand and a frankly ludicrous compensation+work/life balance achievable due to the places it's used, but I like to lead with the warnings first because it's easy to be suckered if you're new and you're handed a VB.NET undocumented fucking hellmess that was never mentioned in the interview and they claimed that you'd be doing "greenfield .NET development, maybe a little legacy support" (I'm just still salty over that job rugpull, don't worry about it, lol)

So, if you have a place using "ASP.NET Core" (specifically), and something reasonable for the front end (imo React or Ember) for the front end, that's modern and it's likely a team that uses best practices in other regards too.

2. I'll be honest: are you looking to make websites for yourself for fun/things you want to create, or are you looking to do it professionally for other people for profit? Because it greatly varies.

If you just wanted to make your own websites for cheap, PHP LAMP stack is still fucking unbeatable in terms of price for hosting (even though I really hate PHP as a language). Until the replacement is made, KiwiFarms/Xenforo is still a PHP site. Unless you had a specific reason or goal for using C#, I'd have a hard time justifying it if you're the one paying for hosting because it is so much more expensive. .NET is used by companies with massive budgets who don't really give a shit that their Azure instance is costing them $10k a month.

So, assess your needs and goals, and that will help narrow down what might work best for you. Ultimately, if you know how to build a secure RESTful API in one language, it's pretty easy to swap between languages imo.

3. It depends. In industry everything is leaning towards webstack/Electron/WebAssembly to replace desktop applications. Why? Because it allows us to unify and singularize all the UI shit across platforms. Also, removing the need for people to install shit (in increasingly restricted corporate environments for internals and install aversion for externals) is nice. Electron/similar concepts are typically used when a locally installed version/access is absolutely needed, but the real modern trend is using WebAssembly in conjunction so that you can also just do it in browser. That's how you have shit like Photopea working as well as it does.

Edit: beat me to it, haha

I understand the current .NET world technology is MAUI, but I don't have experience with this so couldn't tell you precisely what it's like. Typically most business applications are web apps unless there is a specific pressing reason for them to not be. I propose ignoring this for now and focusing on web applications as that's where the work is.
In my personal experience, Microsoft pushes Blazor and MAUI, but everywhere just ignores them and uses whatever their preference of desktop webstack if they really need a locally installed version. Which 95% of the time means Electron with React.
 
If you look at its actual scores in things like leetcode and codeforces, GPT-4 is pretty bad. Apparently last Advent of Code someone tried to do it just using AI and didn't even make it past day 4. The LLMs are really good at dealing in small snippets of fairly well-known code, but I imagine they'd shit themselves once you start going beyond a few hundred lines of code.
It's probably for the best.

If GPT started training on Java code made by Indians and Nigerians that's when we're gonna need John Connor.
 
Anybody here in Devops? Where's a good place to start?

The technical advice above is good. As a more general rule, regard developers as your customers, and the things you create as products designed to make their lives easier. If you're transitioning into a DevOps role right now, then start talking to devs about what tasks are the most time-consuming, and start knocking those down. If you're hoping to get a job in DevOps, and you're working on your own mini-projects to develop some technical abilities, think about how what you're doing makes it easier for a large dev team to work on a large project.

Thanks you so much @Cold Root Beer and @Fcret for answering my questions I have a couple more if you don’t mind.

1.Is C# an outdated language? Do companies still use C# to write desktop applications and use ASP.NET for websites? If I’m understanding what you guys are saying it’s only used to maintain old programs right?

C# is the fourth most popular programming language on IEEE Spectrum's survey, so no, it's not outdated. Most development jobs are maintaining established code bases, and there is a lot of enterprise software written in C#. Heck, there are six-figure jobs for COBOL developers open right now on Indeed...not that I recommend COBOL if you're going to spend time on something new.

2.I want to learn html css and JavaScript to make websites. I plan on using C# to deal with the backend stuff. The only thing I’m worried about is forgetting C# while learning these new languages. How do you guys learn new languages while still remembering the old ones?

Stack Overflow. I don't even remember everything I know about my primary programming language, C++, let alone the others I know.
 
Say, I have a collection interface and concrete classes implementing it. To speed up updating/removing items from collections, when a item is inserted, a collection returns data relevant to item storage, which is used later when the item is updated, and for every collection class the type of data is different. Question: how do I make these collections interchangeable?

More concretely speaking, I want to implement different types of broad phase collision detection, I store all my objects in an array along with index data, but if I wanted to swap uniform grid for quadtree, I'd have to replace all UniformGridIndexData for QuadtreeIndexData, how do I avoid that?
Here's a code snippet:
JavaScript:
//collection interface
interface SpatialIndex<T, U> {
    
    function add(item: T): U;

    function update(item: T, data: U): Void;

    function queryBox(box: Box): Array<T>;
}

//concrete class implementing it
class UniformGrid<T: Indexable> implements Partition<T, UniformGridIndexData> {
    
    function add(item: T): UniformGridIndexData;

    function update(item: T, data: UniformGridIndexData): Void;

    function queryBox(box: Box): Array<T>;
}

//here's how it's used
var broadphase = new UniformGrid<Body>();
var items: Array<Tuple<Body, UniformGridIndexData>> = [];
for(i in 1...10){
    var body = createRandomBody();
    var data = broadphase.add(body);
    items.push({a: body, b: data});
}
 
More concretely speaking, I want to implement different types of broad phase collision detection, I store all my objects in an array along with index data, but if I wanted to swap uniform grid for quadtree, I'd have to replace all UniformGridIndexData for QuadtreeIndexData, how do I avoid that?
I expect that UniformGridIndexData and QuadtreeIndexData represent the same fundamental idea to want to use them interchangeably in this way, so perhaps they are united as an interface or base class, say AbstractIndexData?

I'm not a Java guy but I expect that in SpatialIndex<T, U>, you could add a constraint such that U must be a subtype of AbstractIndexData, then add() returns AbstractIndexData, then you can leave it up to implementations to know what to do with it.

In a nutshell, either you have a large refactoring concern as you mentioned or you need to find the commonality between the two classes in order to refer to them interchangeably.
 
  • Like
Reactions: ngrlcs
I want to learn html css and JavaScript to make websites. I plan on using C# to deal with the backend stuff. The only thing I’m worried about is forgetting C# while learning these new languages. How do you guys learn new languages while still remembering the old ones?
Others already got in with the good metaphors, but you don't really forget. You will get rusty, you will forget keywords and syntax, but it doesn't take long to reorient yourself thanks to prior familiarity and the underlying concepts remaining the same. Plus the internet is your friend; Stack Overflow and W3School are lifesavers half the time.

As an aside this is why if you're looking to code websites professionally it's IMO worth it to try and land a full stack role to start. You'll get far more experience with various languages, paradigms, and architectures (and faster) than you would just doing backend or frontend exclusively.
 
Not sure if this is the right thread but Programming Pearls is a great programming book for anyone interested in real-life C(and a bit of ancient C++) code beyond textbooks. I was always wondering where data structures and algorithms are actually applicable and this book helped me out a lot.
 
Back