1

I am in the process of building a framework for C# and TypeScript.

Say for example I have the following class in C#

class Validator
{
    public bool Validate(string value)
    {
        return someCondition;
    }
}

I want exactly the same functionality in TypeScript, but according to the coding guidelines, I should use camelCase for functions

class Validator {
    public validate(value: string): boolean {
        return someCondition;
    }
}

I want to know if I should build each framework according to the coding guidelines for each language independently, or if I can ignore this for a cross language framework?

3
  • What would be the benefit of ignoring the guidelines? I'm pretty sure typescript is just following conventional Javascript.
    – Jesse Good
    Aug 4, 2015 at 10:14
  • 1
    @JesseGood ignoring the guidelines would only serve to keep the API naming precisely the same across languages; i.e. GetData() and Validate() would be the same in C# or TypeScript, whereas by sticking to the guidelines, I would have to use getData() and validate() Aug 4, 2015 at 10:33
  • 2
    In that case, there is no benefit for the users right? A user of your framework would expect the code to follow C# coding conventions when using C# and typescript coding conventions when using typescript. I'm sure you will find this to be the case in any framework or library that has ports to various languages.
    – Jesse Good
    Aug 4, 2015 at 10:45

1 Answer 1

4

Stick to the guidelines for each language.

Those coding multiple languages are used to following the guidelines for the current language. Those who just use one language would get annoyed if you follow another language's guideline.

The symmetry is all in your head.

1
  • +1.... would also like to mention the fact that this is one reason why using a single language in the front and back end is useful (mental shift is real people)
    – basarat
    Aug 5, 2015 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.