Active Members MrGrj Posted October 20, 2015 Active Members Report Posted October 20, 2015 Acest thread este dedicat in special celor care deschid 'en?pe topicuri cu acelasi subiect: "Ce limbaj de programare tre' sa invat ?"This is an interesting question. I'm going to take general use into consideration as well. For example, you can use Java with the web, but it's generally not a hugely popular choice there.Single most powerful is C hands down. Pretty much everything goes back to C at some point. It's definitely not the easiest to use, but power? You've got it all there.If had to pick two that are reasonably well situated for a large number of areas there are a couple routes I could go. Java and JS would probably be one. With JS at this point you've got the entire web, and you can do it well with that (of course you need HTML/CSS, but JS is the driving force). With Java you've got fully cross platform (don't even need to recompile most of the time) application development that works well with the console and desktop apps. Also its built in UI toolkit is very powerful and fairly easy to learn. You've also technically got Android (main reason I picked Java over C++), though a lot of the code is used differently and there's a lot to learn to do that well. That's probably the most complete pair, beyond that I'd go with C++ and Python. Python has the same cross platform functionality of Java as it's interpreted. C++ is an OOP, general purpose powerhouse of a language that stretches pretty far into everything from application and console development to gaming. Python is more lightweight, but still very powerful and works well with the web thanks to Django.JavaI can't believe I'm saying this - and even more incredulous that I'm listing it first. Java has a laundry list of issues, and it actively opposes 70% of what programming languages are meant to accomplish and does a pretty piss-poor job at 29% more. People programming in Java should wear boxing gloves, because the language itself will fight you every step of the way. In many ways, it's as much a "programming language" as IE is a "web browser" - it's gotta do more than quack to meet the criteria for a duck.BUT...It's reliance on JavaVM (technically making it a interpreted language, even though it has a compiler) makes it insanely portable - its 1% shining glory. It's practically EVERYWHERE (mind-blowing, isn't it?) and is actually semi-capable for limited lightweight applications - ideal for web apps, most mobile apps, and other places where "quick and dirty" is preferable to "clean and powerful".C (and C++)Most everywhere else in the computing world, when you need tyrannical control, ultra-fine precision, blistering speed, and/or mind-numbing power, the only way to beat C is to program in Assembler (which can be done within C code itself) or the CPU's native bytecode. Virtually every OS on the planet is written in C or C/C++. The majority of actual software (as opposed to lightweight apps) is written in C or C/C++. Damned near every video game ever made was either written directly in C or C/C++ or powered by a game engine written directly in C or C/C++. Graphics drivers, physics, and the like are written almost exclusively in C. For virtually any electronic device ever created which can call itself a 'computer', the first software ever written for it was a C compiler. Even most other programming languages were written in C or C/C++.BUT...With great power comes great responsibility. The trade-off for all of C's phenomenal cosmic power is that it gives you nothing for free. Where Java is like living with your parents (strict non-negotiable boundaries, but few responsibilities), C and C++ are like living on your own (no boundaries, but you're responsible for EVERYTHING - most notably, housekeeping).C++ is a superset of C (as should be obvious by the name alone) which enables a programmer to utilize any programming paradigm they wish - C itself is strongly procedural (actually the most computer-like paradigm - ie, most efficient) and doesn't lend itself well towards OOP (which gets WAY too much hype, even for its own good). This results in C++ being something of a mixed bag, extremely difficult to learn to use well but power beyond belief if you can actually learn it.One key trait of proper compiled programming languages is the two-step process from source code to machine code - compiling and linking - and the act of compiling makes the source language irrelevant. You could write part of the software in C, part in C++, part in Visual Basic, part in Assembler, and link them all together into a single coherent executable. (Even though you CAN include VB, doesn't mean you should.)C programmers will occasionally find themselves writing small optimizations in Assembler (which a C compiler can handle just fine) and sometimes writing non-procedural routines in C++. Not "necessary", but good programmers make use of every tool at their disposal. Nothing to prevent you from writing the entire thing in standard C - might take a little longer, but it'll blow the doors off just about any other language.C and JavaThese days, I'd say C++ and JavaScript. They're both incredibly powerful languages in different ways.C++ is the defacto standard of low level programming, OS development, game development, and other computationally expensive programs. And if you want to extend another programming language, chances are you're writing a C binding. It can compile to probably every machine in existence. C++ also has classic imperative style as well as classes for object oriented style.JavaScript is the defacto language of the web, by virtue of being the only language browser's directly support. But it's also gained popularity on the server side with node.js, and has a far reach into desktop applications using node webkit or node-webgl. You can even run node.js on embedded devices now with raspberry pi. It also is an imperative language, but it has many ways to operate like a functional language as well. It can do OO, but unlike C, does it using prototype based inheritance. Where C's power comes from its ability to access any low-level functionality, JavaScript is powerful in that it provides many more language constructs that can make programming easier. Closures, first class functions, object literals, typeless variables (and soon, optional typing), etc. The only major thing i can think of that JavaScript can't do is lisp-style macros unless you use strings as tokens.Taking JavaScript and C together, you can do anything. Any low level thing could be introduced into node.js via a c extension. Any high level thing can be done in JavaScript. It's somewhat of a power combination.Propria mea parere: C + Python.Mai multe puteti citi aici Quote
Che Posted October 20, 2015 Report Posted October 20, 2015 Ce poate face Python si nu poate face C/C++ ? @MrGrj Quote
Nytro Posted October 20, 2015 Report Posted October 20, 2015 E mai rapid de scris in Python:import urllib2response = urllib2.urlopen('http://python.org/')html = response.read()#include <winsock2.h>#include <windows.h>#include <iostream>#pragma comment(lib,"ws2_32.lib")using namespace std;int main (){ WSADATA wsaData; if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) { cout << "WSAStartup failed.\n"; system("pause"); return 1; } SOCKET Socket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); struct hostent *host; host = gethostbyname("www.google.com"); SOCKADDR_IN SockAddr; SockAddr.sin_port=htons(80); SockAddr.sin_family=AF_INET; SockAddr.sin_addr.s_addr = *((unsigned long*)host->h_addr); cout << "Connecting...\n"; if(connect(Socket,(SOCKADDR*)(&SockAddr),sizeof(SockAddr)) != 0){ cout << "Could not connect"; system("pause"); return 1; } cout << "Connected.\n"; send(Socket,"GET / HTTP/1.1\r\nHost: www.google.com\r\nConnection: close\r\n\r\n", strlen("GET / HTTP/1.1\r\nHost: www.google.com\r\nConnection: close\r\n\r\n"),0); char buffer[10000]; int nDataLength; while ((nDataLength = recv(Socket,buffer,10000,0)) > 0){ int i = 0; while (buffer[i] >= 32 || buffer[i] == '\n' || buffer[i] == '\r') { cout << buffer[i]; i += 1; } } closesocket(Socket); WSACleanup(); system("pause"); return 0;} Quote
Byte-ul Posted October 20, 2015 Report Posted October 20, 2015 (edited) @Nytro pe acelasi principiu cu Python merge facut si in C++#include <bossdeboss.h>int main (){ char buffer[] = functiedeboss("www.google.com"); return 0;} Edited October 20, 2015 by Byte-ul 1 Quote
PingLord Posted October 20, 2015 Report Posted October 20, 2015 (edited) Ruby :require 'net/http'response = nilNet::HTTP.start('www.test.com', 80) {|http| response = http.head('/')}puts response.code Edited October 20, 2015 by PingLord code tags Quote