Jump to content

Spartan-S63

Member
  • Posts

    60
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Spartan-S63 got a reaction from fizzlesticks in is it a bad idea to teach myself a programming language?   
    I would argue it's actually detrimental to learn C before C++ because even though C and C++ are interchangeable, C teaches bad C++ habits. The biggest that come to mind is the unneeded malloc() calls in C++ (new and delete, respectively, or unique_ptr and shared_ptr in C++11) and C-style casting, not to mention the void* data type. In C, given kernel-level development, it makes sense to have void* but in a general purpose application, you better not be using that. And the C-style cast is dangerous in C++. Instead you should be using static_cast, dynamic_cast, reinterpret_cast, and const_cast. C-style strings are also deprecated in C++. Sure, the std::string class is just a wrapper for C-style strings, but it makes it a ton easier to manipulate and work with strings in an abstracted way. Another thing is the difference between cout and printf. Printf is unsafe, cout is just better as far as type enforcement and overflow is concerned. Same goes for scanf and cin. Not to mention streams are infinitely better than "scanned" input because you don't have to take in words. It makes processing binary data THAT much easier (especially if you're messing with endianness as well). There are just far too many benefits to learning C++ first, that learning C first if C++ is your goal doesn't make any sense anymore.
  2. Like
    Spartan-S63 got a reaction from alpenwasser in is it a bad idea to teach myself a programming language?   
    I'm going to chime in on my own opinion from programming for many years and working two years professionally as well as starting my undergrad in computer science. I would recommend you start learning C++, not C, not Java, not Python, but C++. The reason why is because C++ is a modern language, teaches good habits, educates you about memory management and lower level optimization while offering the higher level abstractions that Java does as well as mixed paradigm programming (OO and non-OO, which in my opinion is important because purely OO languages are fundamentally flawed because not everything fits in an OO hierarchy). I recommend against C because it has a more niche purpose in system-level programming (kernels, integrated systems, etc) anymore. It's not old by any means, but C++ is a better general purpose language for most jobs.
     
     
    See my above comments about C++. On top of those, Java is cross-platform, but it's fundamentally slower and abstracts memory management, which is crucial to learn first before you learn higher level languages. It's harder to learn those lower level concepts from moving downward. It's important to build a solid base of skill in lower level languages before moving up in level of abstractions.
     
     
    I wouldn't recommend Python. The syntax is pretty confusing, to be honest, and it's another interpreted language. I would only recommend learning Python after learning C++ and Java.
     
     
    Refer to my original two parts, C isn't where you should start.
     
     
    Java qualifies as a high level language. It hides a TON of stuff. C++ would be better because it hides as much as you want it to hide.
  3. Like
    Spartan-S63 got a reaction from dalekphalm in Does this exist   
    Also, for future reference, Visual Studio Professional and higher SKUs have extensions that support various other languages. I do know there's one for IronPython and some for PHP. Visual Studio has been extended for almost any language out there.
  4. Like
    Spartan-S63 got a reaction from linusforsell in Site dev   
    This is a good start, but I'd avoid XAMPP. Instead, download Vagrant and VirtualBox and set up a virtual Linux server for you to serve your pages. And use Sublime Text instead of Notepad++. Sublime Text has a "free trial" that lasts forever with a popup appearing every now and then encouraging you to register the version (but you don't have to). DreamWeaver is a waste of time and its bloated. Sublime Text supports quite a few nice plugins for web development and is lightweight.
  5. Like
    Spartan-S63 got a reaction from rashdanml in Site dev   
    This is a good start, but I'd avoid XAMPP. Instead, download Vagrant and VirtualBox and set up a virtual Linux server for you to serve your pages. And use Sublime Text instead of Notepad++. Sublime Text has a "free trial" that lasts forever with a popup appearing every now and then encouraging you to register the version (but you don't have to). DreamWeaver is a waste of time and its bloated. Sublime Text supports quite a few nice plugins for web development and is lightweight.
  6. Like
    Spartan-S63 got a reaction from alpenwasser in Danger!Don't use ...   
    A statement like that is like making an excuse for why someone's a poor programmer (that's not directed at you). The very power of C/C++ comes from the use of pointers. Statements that tell people to avoid pointers is just creating an excuse for why memory leaks exist. Now, don't get me wrong, not everything should be a pointer, but when they're needed, you should use them. Don't avoid them, use them when they're most appropriate. There's nothing particularly dangerous about them unless you don't understand them and if you don't understand pointers, you probably shouldn't be using C/C++ until you do.
  7. Like
    Spartan-S63 got a reaction from alpenwasser in Why program on Linux?   
    One thing to note is that you stated that Linux is unpolished. What you really mean to say is that the GUI shell is unpolished. Linux itself is a more stable kernel than Windows and it's more polished. However, it's the desktop environments that may appear unpolished to you. Depending on what version of Ubuntu you have, Unity (the desktop environment for Ubuntu) may not be as mature as other versions. The main difference between Windows and Linux is the fact that the Linux kernel and the desktop environment are two separate pieces of software. And since they're separate, you're free to replace it with a more polished looking desktop environment.
     
    The reason why I do a lot of programming on Linux is because a lot of the languages and development environments out there were written to run in Linux. If you look at the Git for Windows software, that's a port by GitHub, but if you want the true command-line Git client on Windows you have to install MsysGit which is a Unix port to Windows. Git itself runs slower on Windows because it's a port to the Windows libraries. Also, GCC (the GNU C and C++ compiler suite) only runs natively on Linux there are ports like Cygwin or TDM GCC for Windows, but it has to set up special paths to emulate a Unix environment and folder structure. The biggest advantage to using GCC over Visual C++ is that your code will still remain portable (and compilable on a Windows machine), but GCC supports more C++11 features than Visual C++ does.
     
    Another reason I like Linux better than Windows is because of its package manager. Instead of always having to go out on the internet and search for a download, the package manager makes it easy with a unified repository of available packages (and you can go out to the internet to find more software not in the official repositories). If you wanted to build PHP 5.5 RC3 from source, you'd run a command to install all the dependencies whereas on Windows, you'd have to hunt and peck to find all the dependencies.
  8. Like
    Spartan-S63 got a reaction from Darkfeign in c# or c++?   
    That's not stupid, that's type-safety. Doing exactly what you described is violating the rules of strongly-type languages. You always need to cast.
     
    C# is a managed language with manual garbage collection. It's a feature of the language not to allow pointer manipulation in the standard environment. While I do like being able to manipulate pointers, it's a feature of C# that it abstracts that degree of control away from the programmer. If you don't like it, don't use the language, but on a whole, the language is sound given the practices and principles the original creators were going for.
  9. Like
    Spartan-S63 got a reaction from alpenwasser in PHP Classes and Objects Question   
    I'll use the chess program you mentioned as an example...
     
    You're right in assuming that a chess program makes no sense in PHP, but makes sense in JavaScript. The reason you're correct is because the two languages have two different goals in mind. PHP is server-side, completely server-side. Everything you do affects the output the server passes to the client, whereas JavaScript is client-side and affects the presentation of the data on the client side. So, for animations in a chess program, JavaScript would move the pieces on the board without reloading the page (via AJAX) and it would have a callback to the server to adjust the position of the pieces in the database. In the event the chess game had an artificial player, the logic for moving the next piece would be processed server side and passed back to the client where the movement would be handled by JavaScript.
     
    Now, continuing to extend this Chess game example, you would create PHP classes to represent the chess board and the pieces. That way, you could instantiate each class and the board on each call from the JavaScript. The database acts as the persistence layer because you'd be querying it to find the location of the pieces on the board every time you made a call to the server.
     
     
    In general, though, classes and objects make sense if you're creating a reusable framework or library to handle each individual request. Take frameworks like Laravel, Symfony, Zend, or FuelPHP and you'll see they're all object oriented. Object oriented design helps to assist in the task of reusing pieces and allows you to create hierarchies that allow inheritance and extension of components already in existence. The most common design pattern is the MVC (model, view, controller) where the Model represents the data in the database, the View determines the presentation of said data, and the Controller calls the Model for data and then passes the data to the View. The Controller is supposed to be the least bloated of the three components and it's also the glue that holds the design pattern together. Think of encapsulating your pages into models, views, and controllers and you'll find that you'll be developing a primitive framework you can reuse for many different website projects you may work on.
     
    Also, remember when you're querying the database that you shouldn't use the mysql_* functions. Use PDO or MySQLi, they're object oriented (and functional, actually), safer, and not deprecated SQL extensions.
     
    I hope this post helps to answer your questions.
  10. Like
    Spartan-S63 reacted to Spartan-S63 in PHP Classes and Objects Question   
    I'll use the chess program you mentioned as an example...
     
    You're right in assuming that a chess program makes no sense in PHP, but makes sense in JavaScript. The reason you're correct is because the two languages have two different goals in mind. PHP is server-side, completely server-side. Everything you do affects the output the server passes to the client, whereas JavaScript is client-side and affects the presentation of the data on the client side. So, for animations in a chess program, JavaScript would move the pieces on the board without reloading the page (via AJAX) and it would have a callback to the server to adjust the position of the pieces in the database. In the event the chess game had an artificial player, the logic for moving the next piece would be processed server side and passed back to the client where the movement would be handled by JavaScript.
     
    Now, continuing to extend this Chess game example, you would create PHP classes to represent the chess board and the pieces. That way, you could instantiate each class and the board on each call from the JavaScript. The database acts as the persistence layer because you'd be querying it to find the location of the pieces on the board every time you made a call to the server.
     
     
    In general, though, classes and objects make sense if you're creating a reusable framework or library to handle each individual request. Take frameworks like Laravel, Symfony, Zend, or FuelPHP and you'll see they're all object oriented. Object oriented design helps to assist in the task of reusing pieces and allows you to create hierarchies that allow inheritance and extension of components already in existence. The most common design pattern is the MVC (model, view, controller) where the Model represents the data in the database, the View determines the presentation of said data, and the Controller calls the Model for data and then passes the data to the View. The Controller is supposed to be the least bloated of the three components and it's also the glue that holds the design pattern together. Think of encapsulating your pages into models, views, and controllers and you'll find that you'll be developing a primitive framework you can reuse for many different website projects you may work on.
     
    Also, remember when you're querying the database that you shouldn't use the mysql_* functions. Use PDO or MySQLi, they're object oriented (and functional, actually), safer, and not deprecated SQL extensions.
     
    I hope this post helps to answer your questions.
  11. Like
    Spartan-S63 got a reaction from alpenwasser in The Evolution of a Programmer   
    I feel bad for that Master Programmer muddling around with COM and Win32 CRT C-code. That stuff is just nasty anymore.
  12. Like
    Spartan-S63 got a reaction from TomWeston in What Language!?!   
    Well, Windows games are written primarily in C++ due to the low-level nature of the language and how intensive games are and the speed at which the code has to execute. For general Windows programs, you can write them in almost any language imaginable. It's better to write certain programs in C# for Windows than in C++ if speed isn't an issue because C# makes Windows development substantially easier.
    Android's native SDK uses Java to write apps, however, there are several technologies out there that allow you to write apps in C# (Xamarin Studio, for example). And Google also offers what's called the NDK (Native Development Kit) for Android that allows you to write code in C, however, it's not a suitable substitute in all situations for writing apps in Java.
    iOS uses a language called Objective-C for their SDK. Developing for iOS requires you to own a Mac or have access to one, so given the closed nature of the iOS ecosystem, the development ecosystem for iOS apps is also equally as closed.
    HTML and JavaScript (with CSS and a back-end server language) is a very good thing to know, it'll get you far on the web, but unfortunately there isn't much of a use for them for native apps. Windows 8 is changing that with WinRT allowing you to write apps with JavaScript and such, but I don't believe it'll gain widespread adoption.
    So, if you're looking for a challenge, I'd suggest you tackle the following languages (in no particular order):

    C++
    Objective-C
    C#
    Java

×