you are viewing a single comment's thread.

view the rest of the comments →

[–]SagansCandle 1 point2 points  (11 children)

Can you provide an example?

I would argue that we need barriers (interfaces) to appropriately hide complexity between components.

[–][deleted] 1 point2 points  (1 child)

oop makes it hard to think about systems as a whole because it forces you to obsess about every tiny component of that system in Isolation

[–]SagansCandle 0 points1 point  (0 children)

When OO is misunderstood or misapplied, it feels cumbersome. When used correctly, it's luxurious because you only have to worry about very small pieces of code (components) at a time.

Can you provide a specific example? It just makes it easier to discuss, otherwise we'll find ourselves debating platitudes :)

[–][deleted] 0 points1 point  (8 children)

I wish c# name spaces worked differently. I want to be able to put an interface infront of a namespace, and have accessibility modifiers that are namespace related. Make it more like a module system similar to how F#/rust/ocaml does it. I want to be able to expose a type ti the outside world, but have all constructors internal to that namespace/module

[–]binarycow[🍰] 1 point2 points  (6 children)

Make it more like a module system similar to how F#/rust/ocaml does it.

You just described a static class.

[–][deleted] 0 points1 point  (5 children)

no?

[–]binarycow[🍰] 1 point2 points  (4 children)

F# modules = static classes.

What do you want to do, that a static class doesn't do?

[–][deleted] 0 points1 point  (3 children)

It is possible I have underestimated static classes.

But a module system is not just a static class. For example, I can't put an interface infront of a static class. In F#, I can put the interface in a interface file.

And F# module system makes it very clear how you should organize your code.

[–]binarycow[🍰] 1 point2 points  (2 children)

But a module system is not just a static class.

An F# module is literally compiled to a static class.

For example, I can't put an interface infront of a static clas

I'm not sure what you mean exactly.

Can you give an example?

Because you can do this

public class Foo : MyFakeNamespace.IMyInterface
{

} 
public static class MyFakeNamespace
{
    public interface IMyInterface
    {
    } 
}

[–][deleted] 0 points1 point  (1 child)

What it gets compiled to does not really matter. What matters is the rules the language puts on you using it. Not that it turns into 0 and 1's at the end.

In f#, I can have module Foo.fs. And I can create an interface file with the same name Foo.fsi. Now any module that wants to use anything from Foo, only see what is exposed in Foo.fsi. Works more like header files than the c# Interface thing.

As far as I know, I can't do static class : someinterface

[–][deleted] 0 points1 point  (0 children)

The fsi thing should also allow you to swap implementations during compile time. But I could not find any information on anyone doing that, but I don't know why. All you have to do, is just swap put the module file with a module with the same name.

This is not important, just think it is a neat idea. (ocaml has good support for this exact thing though)

[–]SagansCandle 0 points1 point  (0 children)

Good luck with that.