Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Greg Kitchin
Greg Kitchin
31,522 Points

Commonalities in programming

I'm writing my own small programs to help consolidate my knowledge, but want to write up some notes of the basic elements that are common to all languages, such as loops, conditions, data types (lists, dictionaries etc) functions/classes, etc, and have them nearby so I can refer to them at a glance. Then, hopefully take the same approach to other languages (currently doing Python, though I've done some Java in the past).

So what elements are common to all languages then?

1 Answer

Daniel Vigil
Daniel Vigil
26,473 Points

I have found programming languages to be similar in almost every way except for the syntax in which the language is written. The languages I have worked with, all have variables, methods, flow control, class definitions and with OO languages the basic format to objects. Their only difference seems to be the syntax. For instance, in Java you create a variable by declaring the datatype, in JavaScript you declare a variable with the keyword "var", while languages like Python and Ruby you can just name a variable.

You can get into more specifics about what is under the hood of the language and why each one requires the syntax that it does but I think if you can get an understanding of general functions like loops, conditions, math functions, comparison functions, functions/methods, classes and Object Oriented programming you will find it to be a lot easier to jump into new languages by focusing more on how the language needs to be structured for those basic elements.