Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I know that Senior Developer doesn't use only one language and only one platform or IDE.

Can you advise how to mix different styles of programming to make efficient code?

For example, best mixing is Perl + Objective-C.

$ObjectiveCLongNameOfVariablesAndMethods are worst for Perl-style, but good for iOS-team.

[self method:[[NSArray alloc] initWithobjects:[hash objectForKey:name]]] style is weird for an eye, but not for perl simple-looking arrays and hashes and autovivification.

Also, i try to mixing SAS + Objective-C style, but here i have a trouble. SAS doesn't support names long names, only 32 symbols. So, big trouble to naming variables.

Another difficulty is features of current language. So, if I can't use current language for a task, that it can solve 'like a BOSS', I become angry and see weird code. Using libraries is good, but it makes code not natural, 'cause eating soup with fork is strange'.

And at the end: where can I trust compiler and interpreter of language? So, C++-style is best for pointers (you make destructors, constructors, etc.), but many languages now support mechanism like ARC in Objective-C or don't use pointers (like C#).

share|improve this question
    
-1: What problem are you trying to solve? –  Jim G. Jul 13 '12 at 11:40
    
problem is: how to mix different styles of coding from several languages. as an answer, i see, that there is no good practice of mixing coding-styles of languages –  gaussblurinc Jul 13 '12 at 13:04
    
The right tool for the job. Use the language you know best that fits the job at hand the best. Use the conventions of that language. Take programming style with you between languages (i.e. logic and algorithms that solve problems rather than the actual statements themselves - like pseudo code) by all means - but don't expect them always to be easy to code or as efficeint as another way of doing it in the second language. Thus, take concepts and ideas (higher level style) and stick to the language's own paradigms and syntax. –  Wolf5370 Jul 13 '12 at 17:16

2 Answers 2

up vote 6 down vote accepted

Keep to the conventions of the language being used.

When using Objective C, keep Objective C conventions in those parts of the code. When using Perl keep to Perl conventions... etc.. etc... etc...

This keeps things more compartmentalized - when you move to a different language it is easier to see that you have moved to it, and others that are used to the language conventions would also have an easier time.

Don't try to get one set of conventions for all the languages you use - this will just make things harder in the long run.

share|improve this answer
    
ok, but if i move to another language, what kind experience i could take to it from another language-coding practice? –  gaussblurinc Jul 13 '12 at 9:54
2  
@loldop - You need to understand that conventions are per language. Most languages do not share conventions (not fully). I can't tell you what you can take, as this is a very vague question. –  Oded Jul 13 '12 at 9:55
    
@loldop: you can take a lot of higher-level wisdom with you, but as far as coding style goes, the rule of thumb is "when in Rome, do like the Romans do". –  tdammers Jul 13 '12 at 16:10

Base your styles and conventions on the language being used.

You may love "{'s" everywhere in your code. You always use a series of "[" and "{" and "(" in the most verbose form. You believe they should be on their own line. Then one day your team is assigned a large development task that requires python. If you don't adapt your style, you will never get your python code to run. Those braces all have different meanings in python, the language where white space has meaning, and the difference between a list and a dictionary is the style of brace.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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