|
so linq looks like it just makes it so you can just write straight sql queries in c# code? i don't see the value
|
# ? Mar 22, 2016 22:20 |
|
|
# ? May 25, 2024 10:36 |
|
HoboMan posted:so linq looks like it just makes it so you can just write straight sql queries in c# code? i don't see the value It's two parts as I understand it -- a common standard for writing code that works through collections in a functional/chaining way (the code you posted), and a syntax in C# that lets you write linq queries in a syntax that is reminiscent of SQL. The first part is just easier to read and write for the most part. The second part I guess is nicer too? I'm not a C# dev.
|
# ? Mar 22, 2016 22:23 |
|
Soricidus posted:what could possibly go wrong "uh, james, ive called you into my office here because it's come to my attention that you've been naming all your variables 'poop' and 'butt'"
|
# ? Mar 22, 2016 22:25 |
|
HoboMan posted:so linq looks like it just makes it so you can just write straight sql queries in c# code? i don't see the value nah, linq lets you use functional programming idioms in .net some of them happen to be named similarly to similar concepts in sql
|
# ? Mar 22, 2016 22:25 |
|
HoboMan posted:so linq looks like it just makes it so you can just write straight sql queries in c# code? i don't see the value nah, you gotta look past the sql-like syntax poo poo. The power is when you have a collection of Turd (like List<Turd>) and you do stuff like: TurdList.Select(turd => turd.ID.ToString()).Where(turd => turd.Color == Color.Green).ToList(). Normally, if you wanted to extract all the ID's as strings from green Turds, you'd have a foreach loop with if-logic that checks the Color and a ToString() and don't forget your placeholder variables etc.etc.etc. Or, if you just want to know RIGHT NOW if there are any brown turds: TurdList.Any(turd => turd.Color == Color.Brown) And that's just the basic stuff. When you start doing .Join(), .Union(), .Intersect(), and poo poo like that stuff can get weird, man. But it's a good weird, ya know?
|
# ? Mar 22, 2016 22:26 |
|
a for loop is like hiring a fancy architect to build your house, then pedantically explaining where you want every individual stud to be placed linq is saying "i want a kitchen, living room, and master bath" and letting the architect figure out the implementation details you're specifying "what" you want, not "how" to do it
|
# ? Mar 22, 2016 22:34 |
|
Finster Dexter posted:nah, you gotta look past the sql-like syntax poo poo. The power is when you have a collection of Turd (like List<Turd>) and you do stuff like: u got your select and where backwards gotta filter then map
|
# ? Mar 22, 2016 22:34 |
|
ok these is good examples and i see how this could be cool&good. did i mention i'm the only software engineer on staff and i don't know poo poo about dicks?
|
# ? Mar 22, 2016 22:48 |
|
HoboMan posted:ok these is good examples and i see how this could be cool&good. https://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b Bloody posted:u got your select and where backwards gotta filter then map Woops. I am bad at this, so
|
# ? Mar 22, 2016 22:52 |
|
HoboMan posted:ok these is good examples and i see how this could be cool&good. you've got it made in the shade then no one gonna fire you if they have no idea what you're doing
|
# ? Mar 22, 2016 23:02 |
|
linq is the best thing about c#
|
# ? Mar 22, 2016 23:17 |
|
the other neat thing about lambdas/linq is that c# has expression trees so you can basically write "functions" in c# that are really expression trees that get compiled to sql at runtime and... well, it's a mixed bag, actually. linq and async/await...and ASP.NET...are the reasons for using C#. you just have to live with windows or a windows VM to use it. Shaggar posted:use MSSQL server and ASP.net 5 WebAPI this except asp.net 4 not 5 because lol asp.net 5 and .net core are seriouslyy not ready.
|
# ? Mar 22, 2016 23:29 |
|
ctps: i made a c# program that generates tcl scripts that run the fpga tools to generate fpga projects from source, synthesize the projects, and program the hardware. its like a giant heap of future unmaintainability im really excited about it on the plus side my jenkins server now gets to have repeatable/reproducible builds
|
# ? Mar 22, 2016 23:32 |
|
we have such sights to show youcode:
|
# ? Mar 22, 2016 23:34 |
|
i dislike how that is formatted
|
# ? Mar 22, 2016 23:38 |
|
Lone_Strider posted:we have such sights to show you its...beautiful
|
# ? Mar 22, 2016 23:52 |
|
there's just something i love about linq blocks nest and chain that poo poo, make it unintelligible
|
# ? Mar 22, 2016 23:54 |
|
Lone_Strider posted:we have such sights to show you
|
# ? Mar 23, 2016 00:26 |
|
I'm real bad at creating long linq chains so I got into the habit of trying to format/comment complicated ones for maintenance sake. But man it's soooo good when you take a bunch of function calls and logic and turn it into a single linq statement and almost never have to touch it again because the work is in separately defined predicate/map methods
|
# ? Mar 23, 2016 00:42 |
|
uncurable mlady posted:linq is the best thing about c# mos def but I think it's also one of the most divisive things about it too. can't think of any other feature that scares people so much. I used to work on a team of old school c++ programmers who wouldn't use LINQ because they thought it was too complicated or slow
|
# ? Mar 23, 2016 01:23 |
|
there's magic in them monads
|
# ? Mar 23, 2016 01:24 |
|
i am always glad i dont do web development, but even more glad now : https://github.com/azer/left-pad/issues/4 https://medium.com/@azerbike/i-ve-just-liberated-my-modules-9045c06be67c#.hhi6b21g5 summary: javascript developer gets sort-of-bogus trademark claim, npm backs up the claimants, developer pulls all his code, chaos reigns one of his modules was, in its entirety, code:
|
# ? Mar 23, 2016 01:55 |
|
fritz posted:i am always glad i dont do web development, but even more glad now : You forgot the part where a bazillion packages depended on that 11 line package. Ember, react native, and babel won't build right now, among others.
|
# ? Mar 23, 2016 01:57 |
|
Arcsech posted:You forgot the part where a bazillion packages depended on that 11 line package. Ember, react native, and babel won't build right now, among others. i got tired of typing and left it at 'chaos reigns'
|
# ? Mar 23, 2016 02:01 |
|
fritz posted:i got tired of typing and left it at 'chaos reigns' Also apparently (according to comments,so take with a grain of salt) when you unpublish an npm package it frees the name so anybody can claim it for whatever they want Lol E: I guess this isn't quite true due to some fuckery with version numbers but close enough Arcsech fucked around with this message at 02:10 on Mar 23, 2016 |
# ? Mar 23, 2016 02:06 |
|
lol @ javascript "development" in general e: but seriousposting that sounds like a super lovely move by npm HoboMan fucked around with this message at 02:19 on Mar 23, 2016 |
# ? Mar 23, 2016 02:08 |
|
lmao
|
# ? Mar 23, 2016 02:14 |
|
AWWNAW posted:mos def but I think it's also one of the most divisive things about it too. can't think of any other feature that scares people so much var
|
# ? Mar 23, 2016 02:26 |
|
var is weirdly divisive, I don't think I've ever heard a good argument against it though. it makes things so much more readable and clean
|
# ? Mar 23, 2016 02:33 |
|
isnt kik some lovely chat app 4channers use to coerce naked selfies out of teenagers? how does that poo poo have enough legal clout to pull shenanigans like that.
|
# ? Mar 23, 2016 02:37 |
|
uncurable mlady posted:var is weirdly divisive, I don't think I've ever heard a good argument against it though. it makes things so much more readable and clean static typing peeps are against it cause they think it gets rid of static typing for some reason
|
# ? Mar 23, 2016 02:38 |
|
LeftistMuslimObama posted:isnt kik some lovely chat app 4channers use to coerce naked selfies out of teenagers? how does that poo poo have enough legal clout to pull shenanigans like that. VC funded messaging apps have a lot of lawyers
|
# ? Mar 23, 2016 02:41 |
|
uncurable mlady posted:VC funded messaging apps have a lot of lawyers but, like, wouldnt a court take one look at them, realize their app is mostly used by predatory pedophiles, and just tell them to gently caress off? nevermind, im just being naive and wishing the world worked like it does in my head again. chaos reigns.
|
# ? Mar 23, 2016 02:50 |
|
LeftistMuslimObama posted:but, like, wouldnt a court take one look at them, realize their app is mostly used by predatory pedophiles, and just tell them to gently caress off? that's not really how trademark works so no, they wouldn't
|
# ? Mar 23, 2016 02:52 |
|
the funniest part are the people who got hosed by this supporting the dude "yeah you broke my entire build and hosed up my poo poo but fight the power man!!!"
|
# ? Mar 23, 2016 02:53 |
|
in the vein of npm having retarded packages, look at this other vital package for nodejs: https://github.com/tjmehta/is-positive-integer JavaScript code:
JavaScript code:
|
# ? Mar 23, 2016 03:03 |
|
if you can wait until 2017 then this whole issue will blow over (until it happens to another npm package) because the language is getting native string padding!!!
|
# ? Mar 23, 2016 03:04 |
|
Condiv posted:in the vein of npm having retarded packages, look at this other vital package for nodejs: I don't have the link but I remember seeing a dev on twitter posting this dude's npm profile and he had like a thousand packages in his name but at least 50 of them were just like 'ansi-[colour]' so he'd have a package for 'ansi-blue' and another for 'ansi-black' and so on
|
# ? Mar 23, 2016 03:06 |
|
piratepilates posted:I don't have the link but I remember seeing a dev on twitter posting this dude's npm profile and he had like a thousand packages in his name but at least 50 of them were just like 'ansi-[colour]' so he'd have a package for 'ansi-blue' and another for 'ansi-black' and so on Found the guy: https://www.npmjs.com/~jonschlinkert E: other worthwhile contributions include packages such as: git-repo-name - v0.5.1 - Get the repository name from the git remote origin URL. git-user-email - v0.2.1 - Get the email address of the current user from git config. git-username - v0.4.0 - Get the username from a git remote origin URL. git-user-name - v1.2.0 - Get a user's name from git config at the project or global scope, depending on what git uses in the current context. is-even - v0.1.1 - Return true if the given number is even. is-false - v0.1.1 - Returns false if the value of a property is either strictly false, or it's inverse is strictly true. is-number - v2.1.0 - Returns true if the value is a number. comprehensive tests. is-odd - v0.1.0 - Returns true if the given number is odd. month - v2.0.1 - Get the name or number of the current month or any month of the year. month-day - v0.1.1 - Get the current day of the month, according to local time or UTC. months - v1.0.1 - Months of the year. MononcQc fucked around with this message at 03:20 on Mar 23, 2016 |
# ? Mar 23, 2016 03:14 |
|
|
# ? May 25, 2024 10:36 |
|
Condiv posted:in the vein of npm having retarded packages, look at this other vital package for nodejs: So how many things depend on it and is there anything important going up?
|
# ? Mar 23, 2016 03:14 |