loading...

#discuss What language do you think in?

sublimegeek profile image Jonathan Irvin ・1 min read

Think

Scenario

You're in an interview for a job as a developer. You are given a coding exercise to show how you logically attack a problem. You're allowed to use any language of choice.

What language do you go to?

Background

I've always have been fascinated by people who are multilingual and can speak many languages. One question I love to ask is what language do you THINK in? I realize now that while I only speak one language, I can write in multiple...programming languages, that is.

My answer to the above? Java. My first language was PHP and later I worked a lot in Javascript/jQuery until I went to college for Java.

Oddly enough, I still think in Java.

Posted on by:

sublimegeek profile

Jonathan Irvin

@sublimegeek

I'm a full-stack cloud-minded engineer who enjoys devops and clean code.

Discussion

markdown guide
 

I am super surprised by the answers

I think in sets (groupings/state change of data) and graphs (paths of logic)

when i need to pseudocode it will be something in the line of ruby mixed with english expressions as placeholders

 

I'm kind of confused about this question because I don't think I "think" in any language. When I'm breaking down a problem I'm mentally working with fundamental units of work that need to be done and what data structures I need to represent it, which is different from what the code for it actually looks like. "Perform this function on each element of a collection and save the result" is the same work regardless of whether you write it with a map or a for loop or a list comprehension.

For lack of a better way to state it, I might say that I think in English :)

A more practical answer: for interviews I use python, because it's easy to write on a whiteboard and has lots of nice, concise ways of expressing the kinds of data structures and algorithms I usually need to exercise in a coding interview. Lists, dictionaries, tuples, list/generator comprehensions... a standard library that I can guess at functions existing and having a 95% chance of them really existing. I love python for interviews!

 

I tend to think in the language I’m most comfortable with, and the first one I’ve learnt: Python.

Python tends to be extremely close to pseudo code, and it’s a language that has lots of stuff built in. So it’s a very good choice for coding exercises - I can translate ideas in language constructs very naturally without having to reinvent the wheel! Proof is, most coding challenge solutions written in Python I’ve seen rarely exceed 4 or 5 lines.

 
 

This is interesting. I write a lot of Ruby and it's usually my go to if I wanted to represent the logic of a real-world thing. Simple if-else statements are pretty easy to represent in Ruby, it has a really basic OOP structure, so overall my mind goes there a lot.

But... when doing programming, Ruby doesn't really seem like the one I'd default think about as the language to relate things to because it's so high level, and translating to it kind of seems backwards in my mind. I'd say in this sense it's Java. It's the first language I truly learned in any deep sense (though it never stuck very well and I didn't really like it). So yeah, I'll often relate things back to Java in my mind even though I don't even really know it all that well.

 

For me, it's Lisp. Lisp taught me how to think through expression evaluation. Its syntax represents the way all languages (compiled or interpreted) represent themselves internally. Whenever I program JavaScript (the language I know best), I think about the AST that my code produces, and that informs my understanding of how the code executes.

 

I tend to think generically about how data will flow through my system using mostly map, filter, and reduce. I wouldn't say it's tied to a particular language, though it usually ends up being F# or Clojure when I write it out.

 

For years I've been thinking in C because:

  1. It's the first language I really learned, so my "programming logic" is linked to it I guess (that's also why I hated most "modern" language for a long time 😂)
  2. It's low level, so any basic algo I "think" in C can be coded with something else. Also my thoughts are not biased by any language specific simplification.

But to be honest, I've been coding mostly in Ruby for quite some time now and I start thinking in "Ruby logic" also.

It also depends on the problem I'm trying to solve. If the problem is purely OOP, I might even think in Java, since it's the first OOP language I learned (thanks, college...).

 

I think in a hybrid between Python and JavaScript. I think it's because although I primarily develop in JavaScript, I almost always solve programming challenges in Python because I like its more expressive syntax.

 

Very interesting thread. My mind automatically defaults to the language I first learnt which was C. In interviews I tend to resort back to thinking in C but will tend to use other languages based on the scenario the employers has provided. A lot of the time I've found myself writing Python or Java in a interview, having a C mindset can be a bit weird in some cases as I'll sometimes find myself trying to write C syntax inside of a Python script.

 

I think in JavaScript/Java/C# syntax with semicolons and curly braces, but simplified function names and such like Python. Getting in the habit of naming with_underscores instead of camelCase. I started with JS and learned a lot of Java in school. Been using Python recently and I love it, but JS is definitely my most common language, as I'm mostly into web dev.

 

I usually think in a sort of pseudo-code somewhere between Java and Javascript. Mostly just the concept of objects and interactions between specific types, but in a very shorthand Javascript-like syntax. Java was (and still is) my first love, and is the primary way I approach code, but throwing around ideas is much easier with a more dynamic/functional syntax.

So basically Kotlin. I think in Kotlin, my new heartthrob. The more I work in Kotlin, the more I find it to be exactly the way I want to think about Java code.

 

I think because of the MEAN stack and the ideas around Javascript being lightweight but powerful if need be, I end up using it as my "home" language.

I tend to use Python for quick one-offs since that's what my schooling was more like, but knowing the versatility of JS makes me use it as a default and then translate from there.

 

Because of the amount of time I spend working on web projects, I'm currently thinking in Javascript (and some Vue.js as well). Previously my train of thought was (and sometimes still is) focused on Python.

 

For a job interview coding question, I'd choose Python. It seems to fit my brain best, even though I've used Java more professionally.

If I'm thinking through a problem (and probably writing it down) it's going to be a combination of English, Python (occasionally with Ruby-style blocks), and diagrams with boxes and arrows.

 

Kind of agree with any non-programming thinking first. Usually, I will start to ask myself "do we need a database for this?", and then build the hole UML around it (if needed). Then I will ask myself "do we need to access those data from multiple UI?", and if yes, I focus on thinking by APIs to tackle the problem. If not, I usually go down to my favorite tool, Laravel, because it is the moment it has something to offer to solve problems like Queues Jobs, Gates, Notifications, ... (basically opiniated tools, but useful tools that make you earn a lot of times, important enough on a project to consider it against another framework because as it is opiniated it will shape a little bit different your database if any was needed). I usually skip the "pseudo-code" step unless I need to explain a job oriented mecanism (if the problem we are trying to solve requires a lot of domain specific knowledge, in this case I do like a lot of you folks, mixed insert-favorite-language-here + pseudo code).

 

For me it's mainly PHP. As @tux0r said, it really depends on the task and sometimes I would also think about using Python or Javascript.
I don't have much experience in other languages tbh.

 

I definitely used to think in Java, but after so many slow programs it started to make me feel slow lol (I know I'm crazy).

I mostly think in JavaScript and Python now. Python for scattered and unspecific thought and JS, specifically ES6, for anything general and organized. C++ is really reserved for thoughts that need really precise organization. I'm a bad speller (good grammar though), so typing can feel like the spelling of coding. I don't make mistakes with it like with spelling, but it feels like a boring specific that stops my ability to freely flow logically. Sometimes over specificity is necessary for really logically sensitive thought...

Yeah, like I said I know I'm crazy lol.

 

It depends on what language I'm working in the most at that time. Back in college it was C#/C++ and now it's Java. When someone describes a problem to me that they've had in code I always imagine the Java setup for it even if its a python script.

 

Kotlin. Android development with Kotlin is what I did the most for a long period of time and since Java is the first language I learnt for real (what a surprise given the rest of the answers) my mind goes right to it, with Kotlin syntax.

 

Whenever I'm spitballing, or hashing something out on a white board it's usually to outline basic process flow. I always result in a hybrid markup that's a mix of Bash and Python. pure conditional trees are more Bash, while things are Python objects or class.

This doesn't stop at work related things. Personal decisions and planning in my head also use this type of flow as well.

 

I think in JavaScript, it's a real obstacle meeting people.

 

My first programming language was the Commodore BASIC V2 :) I'd love to use it on an interview today but no one would appreciate the effort. Inclusion is an illusion ©®! 😂

 

I'd use JavaScript, because I'm most comfortable with it.

Somehow I think statically typed, don't know why.

 

Mostly in Python, but I always try to solve the problem in a language agnostic way. And btw, I think in English while coding (Spanish is my native language)

 

Depends on the problem at hand. Mostly C, though.

 

JavaScript, without hesitation. I've dabbled in some other languages, but coming from a web development background JS is the one I feel most fluent in.

 

I think in pseudocode then write Golang or Ruby.

 

Really great question 💓
I always think in Python

 

I would say Python! It allows a very flexible way of implementing various solution which goes pretty well with the liberty of exploring several aspects of a problem