Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

OK so you'd want something like Clean-style classes. Something like

public T Foo<T>(Whatever<T> param) where T : (+), (-), (*), (/) { ... }
Oh wait ... in Clean this is possible because the +, -, * and / operators are defined as "overloaded", in C# there'd need to be an interface including the four operators and the types that support those operators would have to implement the interface. Then:

// in Clean foo:: a a a -> a | Arith a foo x y z = x + y * z // in C# public T foo<T>(T x, T y, T z) where T : IArith { return x + y * z; }

A bit more talkative, but as I said ... it's not a problem with the generics per se, but rather with the lack of support for them in the old libraries.

Update: Regarding the ADO.Net as a step in the wrong direction remark: I understand your sentiment regarding the ability to finetune the SQL and have access to the lower levels. The way ADO.Net took though, compared to the old ADO was IMnsHO wrong. While with the old ADO your queries returner recordsets, that could (based on the settings) be taken either as a pipe or navigated freely, with the new ADO.Net you ended up with tons of classes, tables, datasets, datarows, readers, ... It really looked like they expect you to load half of your database to memory and then god know what ... maybe run queries against the local data ... No, I did not like ADO.Net at all.

Now you can treat Entity Framework as just an ORM and let it generate all the SQL based on LINQ queries and hope for the best. Or you can tweak the code generation template and use stored procedures returning exactly what you need exactly how you need, have them propagated all the way to C# in a type safe manner and even have the properties of the returned result rows inherit attributes (even custom ones) you assigned to columns of the tables. Now I do use LINQ and I do let EF generate my SQL ... whereever I'm not yet sure what properties will I need or if the query is simple enough or changes often or I don't care about the speed. If I do care, I define a stored proc, import it into the EF mapping file, tweak the results' attributes if needed and off I go.

There are things I still hate about C#, but it kinda feels I'm going back to the functional languages I used to like at the university. Shame I don't have time to learn F# at the time. Even if I did not end up using it.

Jenda
Enoch was right!
Enjoy the last years of Rome.


In reply to Re^5: What language should I learn? by Jenda
in thread What language should I learn? by extrafied99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (9)
    As of 2014-07-23 08:06 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (136 votes), past polls