[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I'm very new to programing is objective oriented programming

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 10
Thread images: 1

I'm very new to programing

is objective oriented programming writing programs that consist of many different "modules" that can be swapped, replaced and reused in other programs?

did I get it right?
>>
>>58298080
no
>>
>>58298080
no way jose
>>
that's functional programming
>>
Not even close
>>
>>58298080
That's part of it, but that's been normal in ordinary imperative languages for a while, for example C libraries. What really sets OOP apart is that it defines this concept of "classes", which don't only contain data, but also functions that control the behavior of objects. It doesn't give you the ability to do anything you couldn't do before (since all programming languages are Turing-complete), but it does streamline some common usage patterns.

For example, in C your code might look something like
soldier bob, george;
soldier_init(&bob);
soldier_init(&george);
soldier_attack(&bob, &george);


The equivalent code in C++ would be
soldier bob, george;
bob.attack(george);


Here, rather than having to define "soldier_attack" as a globally-accessible function that takes two pointers to soldier-objects, you're declaring it as PART of the soldier-class, meaning you could (for example) have a similarly named function as part of another class, and the compiler would be able to tell them apart by looking at the class-type of the parent object. Additionally, there is no need for explicit calls to initialization functions, since C++ and Java have the notion of a "constructor" which is a function called AUTOMATICALLY whenever an object is created.
>>
>>58298145

OP here

your explanation is the best I've read so far on the internet. thanks for that
>>
>>58298145
yeah that sounds about right

one thing i never understood when i was learning programming is why no one could explain this properly

>durr its programming but with objects
>>
>>58298080
OOP is encapsulation of data and behavior inside an """""""object""""""". These objects communicate with each other by sending messages to each other in various ways (depends on the language). It is a programming style that is supposed to handle state complexity in simulation programs such as vidya games, physics simulations, chemistry simulations etc etc. OOP languages: Java, C#, C++

For handling state complexity in non simulation programs, we have functional programming. Functional programming is prettymuch just math on steroids, it enforces referential transparency and limits side effects in order to reduce complexity (which works much better than just stuffing everything into an """"""""object"""""""). Functional languages: Haskell, Ocaml, Scala, F#

Procedural programming is like the default style of programming, it takes things one step at a time and generally involves manually dealing with state complexity (which every programmer should know how to do before moving on to higher abstractions like OOP). Procedural language: C
>>
>>58298080
>you will never nurse her back to health
Well, shes actually dead
Thread posts: 10
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.