목표 C를 배우기 전에 먼저 C를 배운다.
Apple 개발자로서의 지망생으로서 Objective-C에 들어가기 전에 C를 먼저 배우는 것이 좋으면 커뮤니티의 의견을 듣고 싶습니다.
내 직감은 C를 배우라고 하는데, 그것이 나에게 좋은 기초를 줄 것이다.
나는 C를 먼저 배울 것이다.저는 Obj-C로 이사하기 전에 C(C에서 많은 것을)를 배웠습니다.저는 진짜 C 프로그래머가 아닌 동료들이 많이 있는데, 그들은 Obj-C에서 시작해서 필요한 만큼만 C를 배웠어요.
Obj-C에서 문제를 완전히 해결하는 방법을 종종 보게 되고, 때로는 매우 서투른 해결책이 생기기도 합니다.보통 Obj-C 코드를 순수 C 코드로 교체합니다(원하는 만큼 혼합할 수 있습니다). Obj-C 메서드의 내용은 완전히 순수 C 코드입니다).Obj-C 프로그래머를 모욕할 의도는 전혀 없지만 Obj-C에는 매우 우아한 솔루션이 있습니다.오브젝트 덕분에 훨씬 더 잘 동작(및 외관)할 수 있습니다(OOP 프로그래밍은 함수 프로그래밍보다 복잡한 프로그램을 훨씬 더 사랑스럽게 만들 수 있습니다.예를 들어 다형성은 훌륭한 기능입니다).그리고 Obj-C(C++보다 훨씬 더 좋아!)를 정말 좋아해.저는 C++ 구문을 싫어하고, 일부 언어 기능은 명백한 과잉으로 개발 패턴 IMHO로 이어집니다.단, 동료의 Obj-C 코드를 재작성할 때(그리고 이것이 꼭 필요하다고 생각되는 경우에만 실제로 그렇게 합니다), 결과 코드는 보통 이전에 사용된 메모리의 25%, f% 정도만 필요합니다.실행 시 아스터.
내가 여기서 말하고자 하는 것은 모든 언어에는 장단점이 있다는 것이다.C와 Obj-C는 장단점이 있다.하지만 Obj-C의 정말 큰 특징은 (그래서 자바보다 더 마음에 드는) 플레인 C로 마음대로 점프했다가 다시 돌아올 수 있다는 것입니다.이게 왜 이렇게 좋은 기능일까요?Obj-C가 순수 C의 많은 단점을 수정하듯이 순수 C도 Obj-C의 단점 중 일부를 수정할 수 있습니다.그것들을 함께 섞으면 매우 강력한 팀을 얻을 수 있을 것이다.
만약 당신이 Obj-C만 배우고 C에 대해 전혀 모르거나 C의 기본만 알고 그것이 얼마나 우아하게 문제를 해결할 수 있는지 시도하지 않는다면, 당신은 실제로 Obj-C의 절반만 배운 것입니다.C는 Obj-C의 기본 부분입니다.언제 어디서나 C를 사용할 수 있는 것이 C의 기본 기능입니다.
일반적인 예로는 base64에서 데이터를 부호화해야 하는 코드를 들 수 있지만 외부 라이브러리를 사용할 수 없었습니다(OpenSSL lib 없음).우리는 완전히 코코아 클래스를 사용하여 작성된 base64 인코더를 사용했습니다.정상적으로 동작하고 있었습니다만, 200 MB의 바이너리 데이터를 부호화했을 때는, 시간이 오래 걸렸고, 메모리 오버헤드는 허용할 수 없었습니다.완전히 하나의 C 함수로 작성된 작고 초콤팩트한 base64 인코더로 교체했습니다(함수 본체를 메서드 본체에 복사하여 NSData를 입력으로 하여 NSString을 출력으로 반환했습니다만, 함수 내부는 모두 C였습니다).C 인코더는 훨씬 더 콤팩트하고 속도 면에서 순수 코코아 인코더를 8배 앞섰으며 메모리 오버헤드도 훨씬 적었습니다.데이터 부호화/복호화, 비트 재생 및 이와 유사한 낮은 수준의 작업이 C의 장점입니다.
또 다른 예로는 그래프를 많이 그린 UI 코드가 있습니다.그래프를 그리는 데 필요한 데이터를 저장하기 위해 NSArray를 사용했습니다.실제로 NSMutable Array는 그래프가 애니메이션이 된 이후입니다.결과:매우 느린 그래프 애니메이션.모든 NSAray를 일반 C 어레이로 대체하고 구조체를 가진 객체(모든 그래프 좌표 정보는 객체 내에 있어야 하는 것이 아님), 루프를 위한 간단한 열거자 액세스와 인덱스를 위한 데이터를 하나의 어레이에서 다른 어레이로 이동하는 대신 memcopy를 사용하여 어레이 간에 데이터를 이동하기 시작했습니다.결과: 4배만큼 속도가 빨라집니다.오래된 PPC 시스템에서도 그래프는 부드럽게 애니메이션화 되었습니다.
C의 약점은 더 복잡한 프로그램들이 장기적으로 볼 때 추악해진다는 것이다.C 어플리케이션의 가독성, 확장성, 관리성을 유지하기 위해서는 프로그래머의 훈련이 필요합니다.많은 프로젝트가 실패하는 이유는 이 분야가 없기 때문입니다.Obj-C를 사용하면 클래스, 상속, 프로토콜 등을 사용하여 애플리케이션을 쉽게 구성할 수 있습니다.즉, 필자는 필요하지 않는 한 방법의 경계를 넘어 순수한 C 기능을 사용하지 않습니다.Objective-C 앱의 모든 코드를 오브젝트 메서드 내에서 유지하는 것을 선호합니다.그 이외의 코드는 모두 OO 어플리케이션의 목적에 어긋납니다.다만, 그 방법에서는, 순수 C만을 사용하는 경우가 있습니다.
C와 Objective-C를 동시에 충분히 배울 수 있습니다.Objective-C의 언어 추가를 시작하기 전에 C의 세세한 부분(포인터 산술 등)을 배울 필요는 없습니다.Objective-C를 사용하는 초보 프로그래머는 오브젝트 내에서 빠르게 생각을 시작할 수 있습니다.
이용 가능한 자원에 관해서는 일반적으로 Apple의 문서는 C에 정통하다고 가정하고 있기 때문에 Objective-C 2.0 Programming Language부터 시작하는 것은 큰 도움이 되지 않습니다.Stephen Kochan의 Programming in Objective-C 카피에 투자하고 싶습니다(제2판을 얼마나 빨리 진행하기를 원하느냐에 따라서는,
Programming Objective-C 개발자 라이브러리 Programming Objective-C 2.0 개발자 라이브러리
지금까지의 경험이 없다고 가정하고, 목적 C와 필요한 만큼 C를 가르쳐 줍니다.
조금 야망이 있다면 Scott Stevenson의 "Learn C" 튜토리얼부터 시작할 수 있지만 몇 가지 전제조건이 있습니다("함수, 변수, 루프를 포함한 스크립트 또는 프로그래밍 언어를 이미 알고 있어야 합니다."또한 Mac OS X 터미널에 명령어를 입력해야 합니다."
(레코드 및 컨텍스트 전용:저는 1991년에 두 가지를 동시에 배웠어요.그것은 저에게 아무런 해가 되지 않는 것 같았습니다.BASIC, Pascal, Logo, LISP에 대한 경험이 있습니다.)
Objective-C에 대한 책을 쓰기 전에 이 문제에 대해 많은 생각을 했습니다.첫째, Objective-C를 배우기 전에 C언어를 배우는 것은 잘못된 길이라고 생각합니다.C는 특히 초보 수준의 Objective-C 프로그래밍에 필요하지 않은 많은 기능을 포함하는 절차 언어입니다.실제로 이러한 기능 중 일부에 의존하는 것은 객체 지향 프로그래밍 방법론을 고수하는 성질에 반합니다.오브젝트 지향의 언어를 학습하기 전에 절차 언어의 모든 세부사항을 가르치는 것(및 함수 및 구조화된 프로그래밍 기술로 문제의 해결책을 공격하는 것)도 좋은 생각이 아닙니다.이로 인해 프로그래머가 잘못된 방향으로 출발할 수 있으며, 이로 인해 객체 지향 프로그래밍의 좋은 분야를 육성하기 위한 잘못된 방향과 사고방식이 개발될 수 있습니다.Objective-C가 C 언어의 확장이라고 해서 C를 먼저 배울 필요는 없습니다.
Objective-C와 기본 C 언어를 하나의 통합된 언어로 가르치는 것이 올바른 접근법이라고 생각합니다."for" 문장이 슈퍼셋 Objective-C 언어가 아닌 C 언어에서 온 것임을 알 이유가 없습니다.또한 어레이(NSAray) 및 문자열 객체(NSString)에 대해 배우기 전에 C 어레이 및 문자열(및 문자열)에 대해 자세히 학습하는 이유는 무엇입니까?많은 C 텍스트는 구조 및 구조에 대한 포인터에 많은 시간을 할애하고 포인터가 있는 배열을 통해 반복됩니다.그러나 이러한 C 언어 기능에 대해 알지 못하고 Objective-C 프로그램 작성을 시작할 수 있습니다.초보 프로그래머에게는 큰 일입니다.이로 인해 학습 곡선이 단축될 뿐만 아니라 학습해야 하는 자료의 양(및 그 중 일부는 선별적으로 걸러져 목표 C 프로그램을 작성해야 하는 것)도 감소합니다.
기본 C 기능의 전부는 아니더라도 대부분의 기능을 배우고 싶은 것은 인정하지만, 클래스나 메서드의 정의, 오브젝트나 메시지 표현에 관한 작업, 상속이나 다형성의 개념을 제대로 이해할 때까지 많은 기능을 연기할 수 있습니다.
나는 목표 C에 바로 뛰어들 것이다 - 만약 당신이 이미 몇 개의 언어를 알고 있다면, 그것은 학습 곡선인 구문이 아니라 코코아이다.
어느 분야에서나 C를 배우는 것은 좋은 방법이라고 생각합니다.적어도 패키지 상품을 사용하기 전에 소프트웨어 개발의 내부 작업을 익히는 것이 좋습니다.그러면, 뭔가 잘못되어도 내부 작업을 이해할 수 있는 가능성이 높아집니다.SO에 대해서는 많은 논의가 있고 다소 주관적인 질문이지만, 일반적으로 Objective-C 코드 내에서 C를 사용하기 때문에 이것은 전적으로 당신에게 달려 있다고 생각합니다.저는 기초적인 사람입니다만, 방해가 될 수도 있고, 위에서 아래로 일하는 똑똑한 사람을 몇 명 알고 있기 때문에, 중요한 것은, 자신의 능력을 다른 사람과 구별해, 능력을 높이는 것이라고 생각합니다.
It's a good idea to learn C before learning Objective-C, which is a strict superset of C. This means that Objective-C can support all normal C code, so the code common to C programs is bound to show up even in Objective-C code.
In addition to looking at things purely from a language point of view, you will find that Mac OS X is a complete Unix operating system. All the system level libraries are written in C.
It is probably possible to learn both at the same time, but I think you will appreciate and understand Objective-C more if you have a solid working knowledge of C first.
I'd learn Objective-C and learn as much C as you need as you go along.
The areas of C that you won't depend on much:
- Pointer arithmetic and arrays. I haven't used C arrays at all.
- C strings. Objective-C's strings do the job nicer and safer.
- Manual memory management if you use GC in Obj-C 2.1. I highly recommend this route for development speed and performance reasons.
As you learn Objective-C and Cocoa, you cannot avoid learning bits of C. For example, rectangles are common represented by CGRect, a C struct.
If you have time, by all means learn C. As others have said here, Kochan's book (second and first editions) is excellent as a book to dip into.
There are a lot of things you can't do purely in Objective-C, so learning some basic C skills will be pretty critical. You'll at least need to understand variable declarations and the basic C library functions, or you'll be frustrated.
Honestly, so many languages are based on the C syntax that it's a good thing to be familiar with. I'd take a week or two to familiarize yourself with C regardless.
That said, I did just teach myself Objective C, and I have to be honest: I didn't find my C experience to be as useful as I would have thought. Objective C was definitely eye-opening for me.
You can jump directly into Objective-C, with the following benefits:
- You'll learn "some" C in the way.
- You'll learn the C parts that are relevant for you .
At least for me is easier to learn a new language when I'm interested in some specific app or sample, and I fail when I have to learn other thing that is not exactly what I'm interested on.
You can always refine your C knowledge later if you get interested in lower level programming.
Better, I don't know, even less as I am not familiar with Objective-C.
But bases of C aren't so hard to learn, it isn't a very complex language (in terms of syntax, not in terms of mastering!), so go for it, it won't be wasted time.
Personally, I think it is always a good idea to learn C, it gives a good insight of how computer works. After all, most languages and systems are still written in C. Then move on! :-)
PS.: By "move on", I didn't mean "drop it", just "learn more, learn different". Once you know C, you might never drop it: Java uses JNI to call C routines for low level stuff, Python, Lua, etc. are often extended with C code (Lua reference even just assumes some C knowledge for some functions which are just a thin wrapper to the C function behind), and so on.
Yes, learning C language before any other advanced langauges will help you to learn quiclky other langauges.
According to Wikipedia, Objective-C is a strict super-set of C. This being the case, I would suggest learning C first. Then when you learn Objective-C it will be clear what parts are added as part of Objective-C.
C gives you very little abstraction from assembly. Some C Compilers will even let you inline assembly. This can be very useful for thinking about how the computer works, which is important to know.
That being said, if you're really interested in Object-C don't let yourself get stuck writing something in C just because its "good for you". You don't need to frustrate yourself while you're trying to learn a new skill set. It is important that you have fun with what you're doing.
Do you want to be a hard-core developer? Then learn c first.
The books you need to completely master c are some of the best writings in technology. Here's what you need:
Objective C is sufficiently different from C as to not merit learning C first.
From a syntax / language-family perspective one is almost better off studying SmallTalk (on which objective C is based)
From a practical perspective, focus your efforts on learning one language at a time.
Later, if you wish to learn another language, C++, Java and Python are 1) easy to learn as a bunch 2) popular and thus marketable 3) powerful.
You should have a basic knowledge of C before starting Objective_C, but there's no need master every detail of C.
I've published my notes after reading "Programming in Objective-C" in case it helps someone else.
learn objective c with programming-
Depending on many languages you already know it may be a better idea to just start learning Objective-C. The foundation in most languages are basically the same, it's the syntax that is different. Learning C first isn't really going to make much of a difference when it comes to learning Objective-C.
I learned Objective-C straight away and it worked fine for about a year now, I just had some difficulty reading C code when I downloaded project to see how they work, but now I really feel the need to learn C. You can try learning ObjC without C, but sooner or later, you will need C.
IMHO one should first learn at least some C and especially about pointers. That’s even more important if one comes from a language that doesn’t have pointers. A lot of people ask about code like
NSString *string = [[NSString alloc] init];
string = @"something";
since they don’t know about the distinction between a pointer and the object it points to.
Of course one doesn’t have to learn all of C before one can start with Objective-C, but some fundamental things are absolutely necessary.
Heck no, go straight to objective C!
I moved from ActionScript 3 to Objective C, and I already have an intern at a company!
Do what you want.
If you learn some other language prior, then you will always have confusion in writing right syntax. I do not know purpose, but Object C uses weird (not common) syntax for calling object methods. It names it as sending messages, yes, it is true accordingly pure Object Oriented concept, however most Object oriented languages name that as calling method and use more traditional syntax of calling methods. Garbage collection is also something very odd, Object C is based on old school reference count. So you will have difficulties to accept it if you switch from other language. I am writing a book Object C quick migration guide for C/C++ programmers hoping to help people to pickup all differences quicker.
ReferenceURL : https://stackoverflow.com/questions/180549/learn-c-first-before-learning-objective-c
'programing' 카테고리의 다른 글
| Vuex 저장소에서 브라우저 이벤트 듣기 (0) | 2022.08.07 |
|---|---|
| sqrt(또는 다른 수학 함수)에 대한 참조가 정의되지 않았습니다. (0) | 2022.08.07 |
| 어레이 또는 중첩된 데이터가 포함된 Vuex 양방향 계산 속성 (0) | 2022.08.07 |
| Vuex 스토어에서 JWT 토큰을 새로 고친 후 Axios를 사용하여 요청 재시도 (0) | 2022.08.07 |
| memcpy() vs memmove() (0) | 2022.08.07 |