« first day (2727 days earlier)      last day (2447 days later) » 

16:00
yagni vs 100% not backwards compatible
i prefer interfaces
Interfaces make a lot of sense when working in a team
Interfaces make a lot of sense when working
They act as contracts of behaviour and improve organisational productivity
also, interfaces embrace di much better than anything else
But when you have no choice but to be serial, I see no point to them unless you are writing a library
16:01
ow, and not to mention better support for decorators
@RonaldMunodawafa That's not an interface thing so much as a separation of concerns thing
Also interfaces can't be so great if Haskell doesn't have them
haskell has implicit interfacing iirc
i havent used haskell more than a hello world application :D
@Wietlol eh?
@Wietlol There is no need for interfaces if you support higher order functions
@RonaldMunodawafa ...how are those related
16:03
2 + a = ^
@KendallFrey why does haskell not require interfaces?
type classes might be interface++
yeah, type classes
type classes might be more similar to how traits work in groovy
Will never understand why answers like this have so many upvotes while not even answering the question.
but still, i have not yet understood what traits actually are
@KendallFrey I view the value of interfaces in terms of decoupling your code while keeping it cohesive. When you are going to apply a function in the definition of another function, you could decouple the two by applying an input of the function. And then afterwards, when you apply the newly defined function you simply apply it to the function you intended on applying or to whatever function you find to be a better implementation or one that does what you want. This makes code neatly reusable
16:06
@Wietlol yeah, looks pretty similar
afaik, they can act as advanced interfaces, runtime decorators and some black magic thing
@RonaldMunodawafa Sounds to me like it makes the code horribly abstract for no reason
interfaces are basically to give every class the ability to act as the thing you need
but with static typing
#noJS4ever
type classes are also statically typed
hence why typeclasses are advanced interfaces
(and possibly more than that)
16:09
@KendallFrey It's a more difficult route but if you are aiming for maximum reuse and having all implementations depend on abstractions, it is quite a beautiful route
in any case, im off
later!
Later!
@KendallFrey Abstraction is the goal of software engineering, is it not?
I wouldn't say it's a goal but it's definitely core to OOP
I find FP to make it easier to write more abstract code than OOP while remaining statically typed
It's very easy to go the ducktyped way with OOP once you want maximum abstraction
Y'all need Jesus
16:11
FP statically checked type systems found the sweet spot
Design patterns can go into the bin
Design patterns are for languages that are inadequate
The design patterns of yesterday are the language features of today
For a lot of things, FP helps you view your code very clearly without any need to know what the intention is
When reading OOP code, I tend to be forced to find out from external sources other than the source what approach was used to code a solution
Ah you think OOP is your ally? You merely adopted the OOP. I was born in it, molded by it. I didn't see the light until I was already an engineer, by then it was nothing to me but blinding!
My lecturer often says that OOP hides complexity while FP removes complexity
The biggest mistake for me was thinking OOP was for modelling the real world in terms of the behaviours of real world objects
Complex problems have complex solutions.
Why would you model the real world with OOP?
Complicated problems have complicated solutions. There's a difference between complexity and complication
@RonaldMunodawafa No, software is
16:19
So....I signed my application with a digital signature key. I published used click once. When my co workers download the update Symantec is still saying it does not have a valid digital signature -.-
Complication is what happens when you don't OOP, complexity is what you handle when OOP is done right.
@IamNguele You can have solutions without any OOP at all
Modularity is not exclusive to OOP
The only things I see that are exclusive to OOP are messaging, encapsulation, late binding and dynamic dispatch
In order of importance
I'd say it depends on what you're trying to accomplish, FP might work better in some cases but I never saw any.
FP tends to work well in autonomous/algorithmic/mathematical systems.
@KendallFrey And it works well with data transformations as well
16:25
It doesn't naturally express "things happening", like is the base of user-driven apps
So in those cases it tends to be used more on internal logic
The way data is modelled with alegbraic data types along with structural decomposition, pattern matching, etc it's just beautiful
It also helps thinking of problems and solutions in declarative terms
@RonaldMunodawafa I don't think any of those are specific to FP
@KendallFrey Are algebraic data types not specific to FP?
I thought that was the chunk of FP that sits on top of the pure computational side of things
I haven't seen an non-functional language that supports these features
@RonaldMunodawafa C#'s tuples and structs would count, no?
They are product types
What about sum types
16:29
enums
What about the tagging
Nullable
and you can implement plenty more
But C# claims to support FP
Think of a language that does not support FP at all in its language definition
@RonaldMunodawafa Where?
C# is really bad at FP
@RonaldMunodawafa never heard that
16:31
Also what counts as supporting FP?
Good question
By the way, I find FP in C# more cumbersome than it needs to be
1 min ago, by Kendall Frey
C# is really bad at FP
I think if a language supports immutability by default and referential transparency we can consider it an FP language
Oh yeah and functions as first class values
@RonaldMunodawafa I don't think either of those are FP
Actually I think functions as first class values is the only strict requirement for FP
16:34
@RonaldMunodawafa That's really the main criterion, but it's still a bit ambiguous
Does this make Python functional? In Python, functions are objects
Values vs objects. What is the difference
Does a language supporting functional concepts make it a functional language?
JS has decent FP support but I wouldn't call it functional
@RonaldMunodawafa For one, objects have identity
Values are just there
so are objects
Well, when I say they are just there
They just exist
16:42
so do I
would they be there if they didn't exist?
questions that shall forever remain unanswered
Values always exist
Values are not created
and cannot be created
Expressions can be however
But this obviously not true for most languages
mr5
mr5
Man who make mistakes on elevator
Wrong on so many levels
wow it's the first time I groaned at a pun
@milleniumbug I'd like you to meet @rlemon
17:51
Anyone have any suggestions on the way this enum flags is implemented?
https://gist.github.com/ttrudeau/8496a0945211f605266f69b6529dce09
It feels 'bad' as the logic is decoupled from the enum, so if we change the enum, we have to make sure to change the function as well.
19:19
Why are you guys still here its like half past 9 at night
it's the middle of the afternoon bruh
well one of us is obviously lying, and I know it's not me
Well it's not me
!!xkcd now
Nulable is Godsent in C#
Being bale to decide when a value can be null without null checking is really nice
@Hpjchobbes Flags enums are pretty much an old-programming carryover. They're efficient, but they do pretty much require changing logic anytime you change the enum
19:34
I was looking into BitArray, but Im not seeing how it leads to friendly 'flag' names
If you need the efficiency of being able to store bitflags and Kendall's suggestion doesn't work because you need names or somesuch, you're pretty stuck with it
I'm not sure how likely it is you need the efficiency though. And you need a lot of flags to be worth it
Protip, you probably don't need the efficiency gain
I think enums will use the byte type in flags enums, but that gets you down to a single byte
If you're in such a situation where you need that level of optimization you're not writing C# anyway
I don't care about the efficiency, I just didn't like having to change code in two places if things change
19:36
Last I checked, bitarray allocates Int32s for storage
Then you should use bool variables, possibly wrapped in a struct
the struct's size changing won't do much unless you're doing native interop
and your enum parsing doesn't have to look quite so awful
Do you have an example of how the struct would work? Im not visualizing it well for my needs?
19:52
== true hiss
@RonaldMunodawafa How does Nullable eliminate null checking?
Don't encourage him.
it's called baiting not... ok maybe you're right
@KendallFrey It doesn't. It allows you to have opt-in null, not opt-out null
Doesn't give you that for existing opt-out though
20:00
@Hpjchobbes I'm not sure what your end goal is here, so IDK how to structure it. If it's just a package for passing flags around, I think what you've got it what you're looking for
It's a list of account types (Bank, CreditCard, CurrentAsset, CurrentLiability, Income, OtherIncome) where the user can select one or more selections. There's also some pre-defined selections (like AllIncomeAndExpense or BalanceSheet) which is a combination of account types.
Each of these account types have a numeric value 0-14, which for my query I need to include in a CSV list
We have exactly that situation in our codebase at work
except the numeric bit identifiers
Sure. I think they way you have it set up is what you want, then. If you wanted to pack it a little tighter, you could do something with an internal flags enum and use properties to unpack it each time, but that's a time-memory tradeoff
and I think it's too inflexible to be good, personally.
@KendallFrey I don't see the point of usin Nullable when opt-out
@RonaldMunodawafa I didn't say there was one
20:06
Hello, this may sound like an odd or stupid question, but what is the type of a function in C#? I want to do something like Func<double, double> f = some_bool ? Math.Sin : Math.Cos;but this doesn't work...
@NickA It can work, but your syntax is incorrect.
@Zarenor Yeah, I figured from the errors... any pointers?
a Func<> As you have it is a closure which returns a value. Give me just a sec
some_bool ? new Func<double, double>(Math.Sin) : new Func<double, double>(Math.Cos);
best thing I know of
C# doesn't implicitly convert delegate types well
You can do this as well:
Func<double, double> sinorcos = (double x) => some_flag?Math.Sin(x):Math.Cos(x);
20:11
that's not quite the same
anyone here familiar with winforms, is it possible to have a click event function defined in another class file....as opposed to defining it in the codebehind of a form? But still be able to attach it to say the button click event of the form
some_flag will be captured by the context. I think by value, is the point Kendall is making
Isn't that applying a lambda to the sinorcos instead of the original function, which will have a slight overhead?
Nope. I'm wrong about being wrong. It is correctly closed over
@erotavlas sure
20:14
@KendallFrey so do I just put the function I want to call ina class, then in my form.cs create an instance of it and attach to it there?
That seems weird
but I have no idea what you're actually trying to do
@KendallFrey I did end up using this, thanks both of you
@NickA Just use Haskell :P
@KendallFrey I just want to move my click event function to its own class....out of my MainForm.cs code behind...
but still be able for my button to use that function on click
@erotavlas Why?
20:16
@KendallFrey I thought we weren't supposed to have anything in the codebehind file? or is that WPF
That's a design decision you have to make
I thought it was made for everyone...no code in your code behind file
@erotavlas WinForms lives and dies by the codebehind
Some cases it's helpful to remove it entirely, some cases it's more useful to just keep it
It's a terrible design paradigm but it's WinForms and by definition in kinda terrible
20:18
we cant really separate it out like we can in wpf...so...
(like with commanding for example) just wondering how WinForms does it or doesn't do it
WinForms normally has the events themselves in codebehind, that I've seen. If it's then some class' responsibility that's being invoked, you then call that class form codebehind
But I never got /very/ deep into winforms, so don't count me an expert

« first day (2727 days earlier)      last day (2447 days later) »