Tag Info

Hot answers tagged

101

For context, I'm a Clang developer working at Google. At Google, we've rolled Clang's diagnostics out to (essentially) all of our C++ developers, and we treat Clang's warnings as errors as well. As both a Clang developer and one of the larger users of Clang's diagnostics I'll try to shed some light on these flags and how they can be used. Note that ...


59

Being 3.9 times faster than python, the language that consistently loses most benchmarks by considerable margin (ok, it's on par with Perl, Ruby and PHP; but it loses to anything statically typed), is nothing one should be boasting about. The benchmarks game shows C++ programs that are more than order of magnitude faster than python programs in most cases. ...


38

Is it considered a bad practice to add logic in a property setter? No Properties were invented to allow class designers to have logic attached to a convenient interface of field access and assignment. How much is too much? It depends on the responsibilities of the class. Here are some things that are reasonable to put in a property setter: update ...


30

Fail fast is a good principle - the sooner you know the build is broken, the sooner the offending commit can be identified and the build fixed. Build on every commit is the right thing to do. Building every 15 minutes can be pointless if the project has a high volume of commits within such a timeframe - tracking down the bad commit would take longer and ...


30

You're not wrong. It's just psychologically very difficult to convince people of their own limitations. The reason we have invented maxims, guidelines etc. that restrict what we should do is that we have found, over time, that behaving in a particular way leads to more success. Importantly, it will lead to more success even if it doesn't seem so to us at ...


29

It really is just Apple. Look at the rest of the programming world, and you'll see that no one (within a reasonably small margin of error) outside the Apple ecosystem is using ObjC. You didn't see much growth in Java to correspond with Android for a few reasons: Java was already very popular, so there's less to gain, especially in a system that reports ...


24

It is neither. Objective-C is a programming language. A programming language is an abstract concept. A programming language is a set of mathematical rules and definitions. Programming languages aren't compiled or interpreted, they just are. Compilation and interpretation aren't properties of a programming language, they are properties of, well, a compiler ...


24

IMO, the problem with Objective-C isn't so much massive shortcomings, as minor shortcomings (especially early on) and lack of perceived advantages. Objective-C was a pure superset of C, so C code could transition to Objective-C easily. The mindset to use Objective-C, however, differed from the C mindset a lot. The transition from C to Objective-C is easy ...


23

First, (IMO) comparing with Python is nearly meaningless. Only comparison with Objective-C is meaningful. How can a new programming language be so much faster? Objective-C is a slow language. (Only C part is fast, but that's because it's C) It has never been extremely fast. It was just fast enough for their (Apple's) purpose, and faster then their older ...


21

Unlike C++, Objective-C is designed as a clean superset of C. The few Objective-C compiler I've used are better known as C compilers, but also handle Objective-C. So, it's safe to assume that in the code generation level, C and Objective-C are equivalent. The first difference appears in the OOP ABI, also called "late method binding". Just like in C++, ...


20

In my opinion, there is absolutely nothing going for the success of the Objective C other than the mega-hit status of the iOS platform. Having been around for ages, the language at 26 is probably older than many participants who program it. It did have a circle of faithful followers, but their ranks seldom crossed the single-digit percentage milestone. ...


20

His primary argument was that "he's a good programmer and he can understand and read even the first version fast enough" so he doesn't care if it's written like that or not. If that is his primary argument it may be a sign that he is primarily afraid with being not called a good programmer, or even a bad programmer. IMHO the crucial point here is to ...


18

Fundamentally, computers can only do a few basic things: They can perform simple arithmetic They can execute instructions sequentially They can branch to another instruction, based on a condition They can loop (a variation of branching) They can move data from one place to another They can store data and retrieve it for later use. That's about it. ...


17

MonoTouch is a fantastic alternative. I've been using it for pretty much one year now, and I can't ever imagine going back to objective-c. Highlights: LINQ, LINQ to XML, LINQ, C#, LINQ, Garbage collector, LINQ, MonoTouch.Dialog, and a lot of other things. Seriously, though.. nowadays most apps are always downloading data from the web, and you'll need to be ...


17

You are lost at words. Immutability means: As long as you don't change the variable, it will always "contain" the same value, not matter what you do with other variables. Counterexample in C (a bit simplified, assuming an architecture that allows that): char *a = "Hello World"; char *b = a; b[0] = 'Y'; Now a no longer "contains" (i.e. points at) the ...


16

At this point, it's more important to nurture his interest and attention than his exposure to specific languages and technologies. He's interested in Objective-C? OSX and iOS development has his attention? There's your answer.


15

Nah, I wouldn't worry about it. First off, Apple's two main compiler toolchains (gcc and clang) both continue to support it. In fact, the main page for clang repeatedly indicates support for Objective C++ is a "goal of the Clang project". Second, unlike MSDN, Apple frequently changes their online technical documentation, and links to articles on their ...


14

You absolutely could write SQL queries and store whatever data you need in a SQLite database or just write raw data to a file. In fact you are free to do so right now in an iOS app. Why then might we want a different abstraction? Immediately you're going to notice that your application is working with objects and you need to translate them into some form ...


14

Objective C, like C, has no namespaces. This means that if someone has already defined a function foo or a class Bar, it must be globally unique and you can't define it. This can result in a lot of headaches when you have your code and then add another library and suddenly things break in strange places. There is a guideline presented by Apple for this in ...


13

I'm a seasoned C, C++, Delphi & .NET developer and I recently needed to tackle an iOS application development project with a .NET back-end. I initially got very excited about MonoTouch and climbed into it only to find that the learning curve was not really the language but rather the design patterns. I also noted that the community support out there for ...


12

Objective-C is very limiting, in the sense that it's an almost entirely apple-specific language. C++ will allow support for multiple platforms, and isn't as specific as Objective-C. (Yet you can write programs for your iPhone in C++ as well. objective-C is not a required language. In fact, i write IOS applications in C#) In addition, knowledge of C++ will ...


12

Brad Cox and friends added a thin layer of Smalltalk on top of C. Objective-C thus has much more in common with Smalltalk's highly dynamic message-sending style OO than C++'s. One major difference is that in Objective-C you don't worry too much about what class something is: you care about what messages something understands. You can have objects that ...


12

Basically, Apple's policy is that in order to develop for iOS, you need a Mac. They have all sorts of reasons for doing it that way: increased sales on the desktop market (which isn't exactly Apple's cash cow), controlling the development platform, better brand exposure, you name it. Now, there may be tools to develop iOS apps without a Mac, but these will ...


12

I refactored it to [...] and he kept arguing with me that it's the same thing. Well ... as far as the compiler is concerned, it probably is. As far as maintenance effort is concerned, it is not. His primary argument was that "he's a good programmer and he can understand and read even the first version fast enough" so he doesn't care if it's written ...


11

Setters are typically used to change the state of an object with no significant side effects or heavy calculations;use methods and functions for that. The primary reason for setter implementation is changing and maintaining a valid state. So, limiting range, setting flags to request recalculation, or adjusting related properties is absolutely fine.


10

If you're looking to capitalize on iPhone development, choose to develop projects that are small, which will take you no longer than a few weeks to a month to complete. Realize that most iPhone applications are monetary failures, and those who succeed at making actual money, are those who saturate the market with their throw-away applications. I'm fairly ...


10

I recently wrote a relatively complex web scraper to harvest a TON of data. It had to do some relatively complex parsing, I needed it to stuff it into a database, etc. I'm C# programmer now and formerly a Perl guy. I wrote my original scraper using Python. I started on a Thursday and by Sunday morning I was harvesting over about a million scores from a ...


10

You are confusing variables with objects. Variables can be used to store references to objects, but they are NOT objects. It is objects that are immutable, not variables, so you can change the variable from one object to another, but you cannot change the attributes of the object if its immutable. Think of the object as a loud, drunken neighbour. If he is ...



Only top voted, non community-wiki answers of a minimum length are eligible