Tag Info

Hot answers tagged

33

It seems to me that you are asking two different questions: How if else works internally? What if is in terms of high level programming? This answer is for question 1. For question 2 see other answers. Gustav Bertram's answer seems very clear. Before your code gets executed, it must be translated into machine code. The translation is done by either a ...


17

This answer is about languages like C, C++, Java, PHP and Javascript. There are other programming languages that work differently. if is a keyword, and else is a keyword. When they are used in code, if and else together form a control flow statement. Class methods, or static methods are always functions or procedures that are attached to a class. "Method" ...


8

IMHO, to have a successful career in Software Development you will need to constantly learn. I have associate degrees in programming and networking and have been programming professionally for 12 years, this has required me to continuously learn. My advice is to embrace it. Focus on improving the way you learn. I periodically read blogs, watch YouTube ...


8

Every one(Every one who uses the internet) uses Google these days. No they don't. I don't, but then I am a little biased in favour of another search engine:-) 1.Question : How important do you think this is for a programmer? To be able to use a search engine? Very. 2.Question : How does an experienced search ( more knowledge on the issue ) ...


7

It can actually be several things. In imperative languages like C++ or Java, it is a statement type. In pure object-oriented languages like Smalltalk it is an instance method of boolean. In pure functional languages it is a function. But in all languages it is a primitive. Some form of conditional must be built into the language. It may be slightly ...


6

Question: How important do you think this is for a programmer? Very important. It is impossible to remember everything about programming in your head, and the internet is the biggest help library out there. Being able to quickly and efficiently find what you are looking for is invaluable. Question: How does an experienced search (more knowledge ...


3

I suspect one of the issues with Google and other engines from a programmer's perspective is that they're too dumb. Where's the escape character for instance so I can search for an embedded '.'? a.c, a\.c, and a.c all produce the same result - it's frustrating when you're wanting to search for a particular command switch or error code, etc. Advanced search ...


3

Yes, Googling should be taught, but it already is being taught in most K-12 school curriculums (maybe not necessarily in the best way, but that's a different matter). What's needed at the workplace is for it to be encouraged. Research skills are taught in the elementary curriculum here in Vancouver. It used to be library research back in my day, but they ...


3

Some advices. I'm not saying it's the only way, but it'd definitely give you something to start with. Learn a functional language. CLisp or Scheme will get you started rapidly. Learn system programming. Get your hands on a free Unix and start hacking. Don't overuse your CPU. The two first points are in direct relation with Spolky's article, where he ...


2

As the others have already explained, control flow is usually implemented with branching instructions. But, jumps are not always necessary. In some ISAs there is a so called "conditional execution": instructions will be bypassed if they're marked as conditional and a flag after a previous comparison operation is not set. Jumps can be mispredicted and may ...


2

Since you already know c++, I would recommend learning a functional language. That will give you recursion, which is the other important concept from Joel's article. I have experience with Common Lisp and Haskell and can recommend both. Also, don't worry about being self-taught. You'll probably have more things to learn now that you've left school than you ...


2

I'll take a stab at this. The average programmer is average. He's the Mario of coding, not very good at anything but he does ok. He knows a language or two pretty well, has knowledge of data structures up through hash tables and binary trees. He knows enough math to get by but nothing amazing. He makes a few mistakes in his code but rarely makes colossal ...


2

When I taught programming, one of the mental frameworks I had to put in place was that computers only do one thing at a time, in sequence. (Yeah, yeah, I know - pipelines, cores, blah blah. Parallelism is fine once you understand that computers only do one thing at a time, finishing one step before starting the next.) I had to teach that, by single-stepping ...


2

No, that statement isn't correct. When you build a program the following steps happen: The source files are compiled to object files This takes your source code and turns it into object code. This step turns the source code into machine code. The object files are linked to produce an executable The linker will come along and link your various object ...


2

You would only add members to your Bird class that are common to all birds. If you want to add a member called Fly(), you must either create a FlyingBird class that inherits from Bird, or inherit from an IFlying interface and implement the Fly() method on it. public class Bird : Animal { public float WingSize; ... } public Interface IFlyable { ...


1

If the book says so, then within that book, that is the meaning of the word. Obviously, in other contexts, the result of a build may not be anything usually called “assembly”, so the definition cannot apply there. On a more general note, I don't find it odd to ask if we still have a backup of last Friday's build, so I'd say the usage of the word for the ...


1

It really depends on the language, of course. Since you're giving a pseudo-C example, I'll stick to how it works in most C-like languages. A program has to be translated to machine-code in the end, so we have to talk about machine code first. Let's start with an (imaginary, but that's the idea) very old computer who is able to perform these operations only ...


1

Internally on x86/64 architecture if/else/then is generated with internal CMP mnemonic. It compares the results and sets the EFLAGS register with appropriate flags(zero, overflow, etc.). Internally if the arguments are equal their minus product is zero. For example if (a == b) where a = 10, b = 10. Processor does 10-10=0. Once the result is zero - ZF(Zero ...


1

Once you get down to the metal, it is a jump/branch statement -- basically a fancy goto. Higher level languages have control structures that let you implement common low level activities in a clear and understandable manner. But when you get down to it, it's a bunch of registers, jumps and poking things in and out of memory.


1

Doing some embedded projects where you have to use assembler will give you more insight to where all the "modern" programming is coming from as well. You will also realize that calling languages like Java and C# more modern than languages like Assembler and C. See them more like a fork. The development of Assembler and C is still going on today. They are ...


1

IMHO it's less important than ever. As search and bandwidth costs decrease, the ability of the engines to provide you enough cues to eliminate search results allows you to be more lax since it eliminates the latency inherent in making the wrong search and opening the wrong value. Google instant (and the equivalents on other search engines) let you narrow ...


1

First of all I think the programming schools question depends upon where you are. In the US many programming jobs only go to people with 4 year degrees, so at best this is someone with a computer science degree, otherwise they may not even have taken computer science classes at all. As part of a standard computer science curriculum there is no instruction ...



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