Why did C++ come in the world and still companies needs C?

Why did C++ come in the world and still companies needs C? by Kurt Guntheroth

Answer by Kurt Guntheroth:

There is a lot of misinformation in the answers to this question.

First off, C++ is an almost perfect superset of C, so that anyone wishing to write, for instance, firmware or operating systems, can use the parts of C++ they need, with no performance penalty they don’t agree with. If they use facilities they don’t need and suffer performance issues, well, it’s a poor workman who blames his tools.

Implementing a C compiler from scratch is simpler than implementing a C++ compiler. In 1990 that was an important consideration. These days practically all compilers derive from Visual C, GCC, or clang. All of these compilers read C++, so there is no longer an excuse.

The basic difference between C and C++ is that C is a simple language for solving small problems. If all you want to do is solve small problems, you can learn C quickly. By contrast, it takes about two full-time years to acquire a journeyman’s experience with C++. Some people don’t want to invest this amount of time. They may argue very loudly that C is all you ever need, but the facts are that C++ was developed because C was not good enough for big problems. C has minimal to no support for encapsulation, dynamic variables, or generic programming. Sure, you can do big programs in C, but C has no expressive, well-checked idioms for things you need when doing big programs.

Why did C++ come in the world and still companies needs C?

What are some relationship hacks that actually are worth learning?

What are some relationship hacks that actually are worth learning? by @annaakbari

Answer by Anna Akbari:

This is my favorite area to apply life hacks — in part because we too often think that relationships are left to chance. Trouble is, that doesn’t give you much say in the matter. In love, as in life, we’re looking to “close the deal”—whether it’s marriage, or just getting them to say yes to dinner. Whatever the goal, there’s a market in which we operate, and it’s far more than merely chance that determines the eventual outcome.

And relationships matter because they are the single biggest indicator of long-term, sustainable health and happiness. (In fact, research suggests that not having close social ties is the equivalent of smoking or obesity in terms of its negative impact on health.) But just like with startups, there’s no “safe” path. Relationships are hard, and they’re risky.

A few ways you can hack relationships and harness the power of partnerships to fuel happiness and success:

Don’t go it alone. No startup operates in isolation. And neither do you. You construct your life in concert with others. Friends and clients may turn into business partners. Acquaintances may become gateways to new potential collaborations or introductions. And friends of friends become spouses and life partners. But before you can meaningfully connect and explore the possibilities of these relationships, you need to buy into the fact that partnerships—even when imperfect—make you stronger and life better. More often than not, our output—and our happiness—wanes when we isolate. And remember: living a networked life means committing to both in-person relationships as well as mindful, technology-assisted interactions.

Beef up your soft skills. We most often use the term “soft skills” in relationship to emotional intelligence, or EQ. These skills are the social graces and interpersonal skills that are less easily defined or quantified than hard skills, but which often factor as key differentiators. Relationships, like career paths, don’t fit into a perfect mold. They aren’t always predictable and “safety” is largely an illusion. Risk abounds. Planning is for naught. And failure—to varying degrees—is imminent along the way. You can, however, redefine “success” and rewrite your own rules of engagement, but not just through ticking boxes and downloading apps. Pay attention to the little things. Be bold. Be truly present. And feel the difference.

Become a relationship MVP Come to terms with how you want to conduct your relationship startups. Too often we think in extremes: destiny or practicality. So rethink that strategy to make room for both. What are your non-negotiables? Aside from those, throw out the checklist and check back in with your gut reaction. This isn’t an attempt to oversimplify a complex question, but reverting back to the basics of how you feel and what you need is the simplest way to keep moving forward. Consider it your relationship MVP, or “minimum viable product”: sometimes you need to strip away the noise to understand the core value proposition. And that makes committing to a choice that much easier — and more satisfying.

What are some relationship hacks that actually are worth learning?

Is it possible to make an PC that runs games on ultra for 900€?

Is it possible to make an PC that runs games on ultra for 900€? by Simon Jeau

Answer by Simon Jeau:

900€? HAHAHAHAHAHA, I am pleased to tell you that with 900€ you will be able to build a computer that can run pretty much every game at highest possible settings. 900€ = 945.99 USD. With that kind of money, you could put together quite a beast!

Here’s an example build that I threw together:

Motherboard: Gigabyte LGA 1151 Z170 HDMI 2-Way CrossFire ATX DDR4 Motherboards GA-Z170-HD3

CPU: Intel Core i5 6600K

SSD: SanDisk SSD PLUS 480GB Solid State Drive (SDSSDA-480G-G26)

HDD: WD Blue 1TB SATA 6 Gb/s 7200 RPM 64MB Cache 3.5 Inch Desktop Hard Drive (WD10EZEX)

RAM: Kingston HyperX FURY Black 8GB Kit (2x4GB) 2133MHz DDR4 Non-ECC CL14 DIMM Desktop Memory (HX421C14FBK2/8)

GPU: ASUS ROG STRIX Radeon Rx 480 8GB OC Edition DP 1.4 HDMI 2.0 AMD Polaris Graphics Cards STRIX-RX480-O8G-GAMING

Case: CoolerMaster MasterBox 5 Mid-tower Computer Case

PSU: EVGA 700 B1, 80+ Bronze 700W, Power Supply 100-B1-0700-K1

Unfortunately, it comes out to be $935- or 888.28€. Wait, this is a good thing, right? For me, yes. For you? No. It came out to be $935 on the US AMAZON. Shit. PC part prices in Europe can be a hell of a lot more expensive than in the US. So what should you do?

Simple. Accommodate for the pricing differences.

If the build where you are costs a hundred dollars more, feel free to take out the SSD from the build and just use the hard drive as your boot drive. Perhaps the whole build puts you down $200 more over there. Downgrade the PSU, downgrade the case to one of those $15 generic office mid towers. Downgrade the GPU to a reference model. Downgrade the CPU to a used i5 4690K, and then buy a used Z97 motherboard locally with DDR3 RAM. The possibilities are endless with this sort of thing, all you need to have is a little creativity and patience to get a perfect build that’ll max out all the latest titles.

Also, note that I didn’t include an AIO liquid cooler. “BUT SIMON THERES AN i5 6600K THERE ITS UNLOCKED WHY WASTE OVERCLOCKING POTENTIAL WITH THE STOCK COOLER!?!?!!?!?!” The question called for a build priced at or under 900€, so I delivered. The unlocked processor provides potential for a future cooling upgrade, and I thought it was a better option than buying a $30 cheaper, locked chip. If you want to spend $50 for an AIO liquid CPU cooler (like the Lepa AquaChanger 120), go ahead and throw that into the list of parts I provided.

Anyways, best of luck to you, prospective 900€-budgeted PC builder.

Is it possible to make an PC that runs games on ultra for 900€?

Why is Git so hard to learn?

Why is Git so hard to learn? by Ori Shalev

Answer by Ori Shalev:

Because probably like most people, you skipped the basics. Most people either pick the wrong source to learn Git from, or pick the right one but assume they can skip the introductory parts.

There are hundreds of Git tutorials, but 99% of them are about what commands one needs to run to get some outcome, rather that really understanding the mental model.

The documentation in git-scm.com is one of those very few sources that explain Git the right way, particularly in this page – Getting Started – Git Basics.

Apparently, the people at git-scm are well aware of the importance of not skipping the basics – they included the following in Paragraph 1:

This is an important section to absorb, because if you understand what Git is and the fundamentals of how it works, then using Git effectively will probably be much easier for you.

Why people tend to skip the basics? it’s probably a combination of the following:

  • Skipping the basics worked for them with most other tools
  • They pick the wrong tutorial
  • They don’t realize that the git model can be substantially different than what they know about version control
  • They need something right now, it’s easier to just copy/paste a command from a web cheatsheet or ask a coworker
  • They needed something “right now” on several occasions, and after a few times, they feel like they already know enough and they won’t learn anything new by reading the basics

Why is Git so hard to learn?

In computer programming, when you declare something using brackets, what is it called?

In computer programming, when you declare something using  brackets, what is it called? by John L. Miller

Answer by John L. Miller:

It all depends upon the language. The example you give above is called a template. It’s a way of taking a generic data structure / class definition, and specializing it for a data type.

For example, without templates we used to have to create a special list for each data type. An IntList class for integers, a FloatList class for lists of floating point numbers, and so on. If you were clever, you created a List class, and created subclasses for each new type you needed, e.g. IntList : List and FloatList : List, but it was still the same problem.

With templates, you can specify a type to be used internally in the definition. When you create an instance of a template specialized e.g. to int, then everywhere that type parameter (named ‘T’ by convention) is used gets automatically declared as the type you specified in the angle brackets.

public class MyList<T> {
    T [] m_items;
	T GetItem(int n) {return m_items[n];}
    ... 
} 

MyList<int> intList; 

In computer programming, when you declare something using <> brackets, what is it called?

Why is ChromeOS considered an OS when it relies on a host OS to do the heavy lifting?

Why is ChromeOS considered an OS when it relies on a host OS to do the heavy lifting? by Jeff Nelson

Answer by Jeff Nelson:

Several people forwarded this question to me. Thank you!

I think of webtops as a new OS architecture, in the sense that a webtop is a new execution environment layered on top of a host OS, similar to how consumer OSs are layered on top of a BIOS.  The host OS is low-level, close to the bare metal, and the webtop is high-level, far away from the bare metal.  For the host OS, applications run in machine code.  For the webtop, applications run in HTML or associated web technologies.

Chrome OS is also largely kernel agnostic.  To date, it's been built on top of a number of distinct Linux kernels, but there's no reason the underlying kernel even has to be a Linux. It could be any OS that can manage the devices and provide an execution environment for Chrome.  Again, this is very similar to how a BIOS provides an execution environment for the host OS. 

The question details also mention a VM.  In a sense the browser execution environment can be considered a form of VM.  It's an interpretted VM that is comprised of an HTML interpretter and a collection of other interpretted and bytecode execution technologies.  It can be taken as a whole as one meta-VM implementing the HTTP protocol and a language for implementing web apps. 

So, I'd agree, that in a sense Chrome OS could be considered a virtual machine architecture, rather than an OS.  However, it's also hiding all the details of the underlying OS. For example, if you built Chrome OS on top of Ubuntu or SUSE, a user couldn't tell the difference, because we don't let them get any closer to the bare metal than the browser execution environment (unless they put it in dev-mode, of course).  So, it's not exactly a virtual machine, because by design, there is no lower level of access to the bare metal and it's devices.  If you want to run an app on Chrome OS, it has to be a web app.  Since that's the entire execution environment, it can be considered an "OS".

Some people have also compared Chrome OS to JavaOS.

JavaOS

In my view, they are apples and oranges.  They are both fruit, but they are entirely different fruit:  Java OS was based around the concept that everything would be run on a Java VM, and every application would run locally as a Java applet.  It failed, because there really weren't many Java applets and none of them were of a quality to compete head to head with Microsoft products.  Chrome OS is based on the concept that everything WON'T be run locally, instead all apps are distributed in the cloud and run as web apps (although some can be cached and synced locally for the convenience of users who go offline).  Obviously, there's plenty of web content and some of it is good enough to compete with Microsoft products, which is one of the reasons Chrome OS has been such a success.  Chrome OS also doesn't include a Java VM, so there's really no similarities with JavaOS or it's product vision.

Chrome OS is also compared frequently to the "Network Computer", which was a product of Oracle back in 1996.  Oracle's NCOS was a derivative of RISC OS, and designed to boot over the network. 

RISC OS

That's how it gets the name "network computer"; it's a diskless computer that boots over the network, much like PXE boot, today.  In fact, Oracle published a specification for "network computers" that was so broadly defined, it encompassed every computer – even Windows. The Oracle product, however, was  a full Unix, with the Unix architecture, and running native apps locally just like every Unix.  So, again, there's not really even a slight similarity with the webtop architecture and the "network computer" architecture.  Chrome OS is not designed to run native apps, it has a disk, and it doesn't do network boot.

The term "webtop" is also heavily overloaded.  It's been re-used as a trademark for a wide variety of products that have nothing whatsoever to do with the modern definition of a web-centric operating system delivered on a laptop.  SCO originally trademarked the term for a product they were selling, a web browser plugin that implemented a VNC viewer.  Motorola trademarked it for a smartphone docking station.  Obviously, these have nothing to do with modern webtops, either.

Why is ChromeOS considered an OS when it relies on a host OS to do the heavy lifting?

If programmers are in such demand, why are companies not hiring people with skills that lack “on the job” experience?

If programmers are in such demand, why are companies not hiring people with skills that lack "on th… by Garry Taylor

Answer by Garry Taylor:

OK, I'm going to be a bit mean here, but bear with me.

If you don't have on the job experience, and you've not made software in your own time, you're not a programmer, you want to be a programmer.

Programmers program, if you've not made anything, you're not a programmer. Employers want programmers, not people who want to be programmers.

OK, that's the mean bit out the way, now onto fixing it.

You've got to make stuff, if you don't have on the job experience, you're going to need to make stuff in your own time, good stuff, cool stuff. If you can put a couple of links on your resume to cool stuff, people will be interested.

If you can make software, you'll get a job, but you actually have to be able to do it, and the easiest way to prove you can do it, is to do it.

Pick a project, write it, include a link to it on your resume. If you do it well, you might even skip the junior positions into something better.

A lot of employers are not interested in your CS minor, they're not interested in your programming course. What they've got is problems they need solved, and solved on a deadline, you need to show you can do that.

If programmers are in such demand, why are companies not hiring people with skills that lack "on the job" experience?

Why is ChromeOS considered an OS when it relies on a host OS to do the heavy lifting?

Why is ChromeOS considered an OS when it relies on a host OS to do the heavy lifting? by Jeff Nelson

Answer by Jeff Nelson:

Several people forwarded this question to me. Thank you!

I think of webtops as a new OS architecture, in the sense that a webtop is a new execution environment layered on top of a host OS, similar to how consumer OSs are layered on top of a BIOS.  The host OS is low-level, close to the bare metal, and the webtop is high-level, far away from the bare metal.  For the host OS, applications run in machine code.  For the webtop, applications run in HTML or associated web technologies.

Chrome OS is also largely kernel agnostic.  To date, it's been built on top of a number of distinct Linux kernels, but there's no reason the underlying kernel even has to be a Linux. It could be any OS that can manage the devices and provide an execution environment for Chrome.  Again, this is very similar to how a BIOS provides an execution environment for the host OS. 

The question details also mention a VM.  In a sense the browser execution environment can be considered a form of VM.  It's an interpretted VM that is comprised of an HTML interpretter and a collection of other interpretted and bytecode execution technologies.  It can be taken as a whole as one meta-VM implementing the HTTP protocol and a language for implementing web apps. 

So, I'd agree, that in a sense Chrome OS could be considered a virtual machine architecture, rather than an OS.  However, it's also hiding all the details of the underlying OS. For example, if you built Chrome OS on top of Ubuntu or SUSE, a user couldn't tell the difference, because we don't let them get any closer to the bare metal than the browser execution environment (unless they put it in dev-mode, of course).  So, it's not exactly a virtual machine, because by design, there is no lower level of access to the bare metal and it's devices.  If you want to run an app on Chrome OS, it has to be a web app.  Since that's the entire execution environment, it can be considered an "OS".

Some people have also compared Chrome OS to JavaOS.

JavaOS

In my view, they are apples and oranges.  They are both fruit, but they are entirely different fruit:  Java OS was based around the concept that everything would be run on a Java VM, and every application would run locally as a Java applet.  It failed, because there really weren't many Java applets and none of them were of a quality to compete head to head with Microsoft products.  Chrome OS is based on the concept that everything WON'T be run locally, instead all apps are distributed in the cloud and run as web apps (although some can be cached and synced locally for the convenience of users who go offline).  Obviously, there's plenty of web content and some of it is good enough to compete with Microsoft products, which is one of the reasons Chrome OS has been such a success.  Chrome OS also doesn't include a Java VM, so there's really no similarities with JavaOS or it's product vision.

Chrome OS is also compared frequently to the "Network Computer", which was a product of Oracle back in 1996.  Oracle's NCOS was a derivative of RISC OS, and designed to boot over the network. 

RISC OS

That's how it gets the name "network computer"; it's a diskless computer that boots over the network, much like PXE boot, today.  In fact, Oracle published a specification for "network computers" that was so broadly defined, it encompassed every computer – even Windows. The Oracle product, however, was  a full Unix, with the Unix architecture, and running native apps locally just like every Unix.  So, again, there's not really even a slight similarity with the webtop architecture and the "network computer" architecture.  Chrome OS is not designed to run native apps, it has a disk, and it doesn't do network boot.

The term "webtop" is also heavily overloaded.  It's been re-used as a trademark for a wide variety of products that have nothing whatsoever to do with the modern definition of a web-centric operating system delivered on a laptop.  SCO originally trademarked the term for a product they were selling, a web browser plugin that implemented a VNC viewer.  Motorola trademarked it for a smartphone docking station.  Obviously, these have nothing to do with modern webtops, either.

Why is ChromeOS considered an OS when it relies on a host OS to do the heavy lifting?

What is the equivalent of a binary executable (exe) as in Windows for Linux?

What is the equivalent of a binary executable (exe) as in Windows for Linux? by @t3nsor

Answer by Brian Bi:

Linux does not use file extensions to distinguish executable files.

When you try to execute a file, the kernel first checks whether you have permission to execute the file. This is determined by the filesystem permission bits. (Example: a file with permissions 0644 can't be executed by anybody.) If this check fails, no further processing is done.

If you really do have permission to execute the file, then the kernel searches for a handler that recognizes the executable format. All modern Linuxes will recognize the ELF executable format; some may have support for the old a.out format [1] or other, more obscure formats. Wine installs a handler that is capable of executing Windows .exe files. In addition, all Unix-like systems, including Linux, will recognize the shebang line (beginning with #!).

If there's a handler that recognizes the file, that handler parses the program headers, loads the image into memory, and so on. If not, an error is returned.

For technical details, see [2]

[1] Note that the file a.out produced by the C compiler is not necessarily in the a.out format; the name is a historical relic.
[2] http://www.linux.it/~rubini/docs…

What is the equivalent of a binary executable (exe) as in Windows for Linux?

Why are text editors more popular than IDEs with the engineers in the software industry?

Why are text editors more popular than IDEs with the engineers in the software industry? by @jeremyhoffman

Answer by Jeremy Hoffman:

This is an excellent observation and an excellent question! It is surprising.

I primarily work in C++ at Google, and my teammates and I all use emacs or vi(m). (I use emacs — the legacy of CS 107 at Stanford.) Here are some reasons I can think of for the widespread use of emacs and vi:

  1. speed — emacs and vi are bare bones, and as such they never hang. Eclipse hanging is sort of a running joke among the engineers who use it. Also emacs and vi support powerful keyboard shortcuts and commands — once you've used them a number of times, you don't need a menu bar to execute them. I don't know how quickly you can switch to another file and view it side-by-side with the file you're currently viewing, but in emacs, I hit C-x 3 C-x-b start_of_other_buffer_na[tab][enter] pretty fast.
  2. habit Most of us picked up emacs and/or vi at some point in our education or careers, got to Google, found official documentation and support for them, and got to work. Call it "inertia" or call it "laziness," but it takes a big improvement in productivity to get a programmer to change his or her tools.
  3. editing is not the hard part — IDEs make some things easier (auto-completion, auto-refactoring). But I think the hardest part of a Google engineer's job is not the code entry itself — it's deciding which libraries to use, choosing the right algorithm, making decisions about tradeoffs, and designing the data structures to be clear and capable. These are not things that an IDE can even help with.
  4. customization — Google has added some emacs libraries that perform useful IDE-like functions, and I've picked up enough emacs lisp to write a few functions to tweak some aspect of emacs. For instance, I wrote an elisp function that toggles the frame width from "wide enough for one 80 column file" to "wide enough for two 80 column files" and assigned it to F8.
  5. non-editor tools — For browsing and understanding existing code, as opposed to editing it, Google engineers have other tools. Likewise for reviewing other people's code changes — we don't do this in emacs or vi. 🙂
  6. consistent style — The entire Google code base adheres to a rather strict Style Guide. (Public version: http://google-styleguide.googlec….) So I can identify at a glance which identifiers are types, methods, local variables, member variables, and global variables. And I can almost always tell which arguments to a function are the inputs and the outputs. So we don't need an IDE for that.
  7. stability, as in constancy — emacs and vim never change. I don't have to worry that an update is going to be forced on me that's going to "move my cheese" and disrupt my workflow.

It may be that early on in the life of a programmer, the features of an IDE are very helpful, but as you get more experienced, you are better able to "run the program in your head," like Cypher in The Matrix. ("You get used to it… I don't even see the code.")

That's not to imply that engineers who use simple text editors are somehow "better" than those who use IDEs. I wish I used an IDE that was better than emacs. The most important thing, at Google or anywhere else, is that you and your team should choose the tools that make you as productive as possible.

Note that this is my personal opinion and reflects my personal experience.

Why are text editors more popular than IDEs with the engineers in the software industry?