[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
C++ vs Objective-C debate
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 27
Thread images: 2
File: C++vsObjC.jpg (62 KB, 728x546) Image search: [Google]
C++vsObjC.jpg
62 KB, 728x546
Ever since people realised that raw C is too basic for mid-level programming two languages were quickly invented, C++ and Objective-C

Both have strengths and weaknesses. In common they fix C's missing features by adding object orienting and automatic memory management and other features.

Which do you prefer? Which do you use? What do you hate about C++ and love about Objective-C, or vice versa? Which do you consider the bester?
>>
>>51264609
Obj-C is slower than Java
C++ is so ugly it makes me throw up
C is the base of everything, there's no need for OO or messages based paradigm bullshits.
>>
>>51264609
>adding automatic memory management
what
>>
>>51267005
>Obj-C is slower than Java
Really? Never heard that one before, but then I've not done more than dabble with either.

Strongly agree with your other two points, however. C++ offends my retinas, and OO is hardly the silver bullet everybody seems to think it is. Like Yossi Kreinin says, where using C++ is an option, using C is probably a better option.
>>
Obj-C was an attempt to implement Smalltalk style OO, it was a bitch to use with manual reference counting, then they added automatic reference counting which made it tolerable. They tried gc, but that never worked as well as ARC. Obj-C is obsolete simply because we don't need languages that traspile to C to fit in memory anymore. The same can be said of C++.
>>
>>51267328

Rust when ?
>>
>>51264609
C, no prefix no postfix, pure C
>>
>>51267641
Swift already
>>
>>51267005
is there any reason to learn Obj-C if not cocoa and iOS programming?
>>
>not coding in Assembly
ayy lmao plebs
>>
>>51267936
No.
>>
>>51264609
>Ever since people realised that raw C is too basic for mid-level programming
Haha, fuck off.

Also, the answer is neither.
>>
>>51268299
C doesn't need nearly everything that C++ adds, but it's still a needlessly cumbersome platform for larger projects.

The preprocessor grammar/semantics, type system in general (and array/ptr decay most notably), and any form of namespacing/encapsulation whatsoever are all inexcusable flaws at this point in time.
>>
>>51267936
OS X programming. GNUstep programming.
>>
>>51264609
What debate? Objective-C is objectively-shit.
>>
It seems people think OO is bad paradigm. Where can I learn why?
>>
>>51269638
people bitch because OO makes it very easy to write bloated code, whereas if you actually know what you're doing, you can accomplish the exact same semantics in C++ as in C code with less verbosity and preprocessor-fuelled bullshit.

also, garbage collections gets sort of mentally thrown in with OO by a lot of people nowadays (Java and C# primarily), which is another whole issue in itself.
>>
>>51269638
Check out function composition and object composition. Whatever feels more natural could be the better paradigm for you.
>>
>>51269638
Because they don't actually program professionally.
>>
File: Has Science Gone TOo Far.jpg (9 KB, 250x209) Image search: [Google]
Has Science Gone TOo Far.jpg
9 KB, 250x209
>>51268299
OK. Then go ahead and write me a linked list in C which can contain any type of structure and that doesn't require either A) macro hell or B) type-casting hell in order to access its members.

The type system in str8c is horribly lacking. What little safety it offers serves more to irritate than to help, since you need to violate rules to do complex things.


Not to mention other problems like the

>>51269638
Do you know that there is a big reaction against the prescribing of valium and an attempt to push doctors into almost refusing to prescribe it except for the worst cases? It is like that. Its uses and functionality were misinterpreted,and applied in places where they shouldn't be, and it had unpleasant consequences.

That's not the fault of OOP. Bertrand Meyer, Alan Cox, these are people who know very well what they are doing. But you can't grab a surgeon's scalpel and complain when you kill your patient to death because you didn't know how to use it properly.
>>
>>51264609
Obj-c is killd by Apple in favor of swift2
>>
>>51269831

> Because they don't actually program Java professionally

Fixed that for you?
>>
>>51271041
>kill your patient to death

smirked
>>
obj-c is just some apple shit and when i tried to use it it felt like ass
>>
>>51264609
Rust and Swift
>>
>>51267059

RAII can be a form of automatic memory management if used properly. Object leaves scope, it's destructor is called, freeing the pointers it holds.

It's not garbage collection though. If you let a raw pointer go out if scope without cleaning it up, you've lost that memory. On the bright side though, RAII is zero cost and wholly deterministic.
>>
>>51274341
>On the bright side though, RAII is zero cost

this is where you'll get people starting to bicker.

RAII is nice for where deterministic destruction semantics are nice, but you can get higher performance in some cases when you can batch or offload to another thread heap management for allocation freeing, which is something that optimized GC systems can do behind the scenes but which can be painful to graft into C++ systems.

But yeah, RAII plus smart pointers is the right design pattern for >90% of systems programs.
It's just a shame that smart pointers weren't a part of the language core grammar and that variadic templates for constructor forwarding are so recent as to not be completely universally handled at this point.
Thread replies: 27
Thread images: 2

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.