Web-Programmers and Programmers
I am in the middle of a school project where we are making a dynamic webpage using HTML, CSS, PHP and a dash of Javascript. Some of the languages has caused hours of frustration and anxiety as things does not behave logical. It is easy to see that these are from two clearly different worlds.
Although PHP is in fact the language I learned before C#, it is not a language I like. Unlike C#, it is a weak-type language which means it does not really care about the type of your objects. Conversion is automatically made and you don't need to worry if one variable is used as two different types. Imagine if you had a box where you could store values in. In PHP, the language doesn't care what box it is as long as there is a box. In strong-type languages like C++, the language requires a special box for integers, one for character and another one for decimal numbers. PHP is not the only weak-type language. Javascript is also a weak-type language and C# is slowly coming after. So why is this such a big deal? Wouldn't types be one thing less to worry about?
Documentation is something we are encouraged to make already from the first class of programming. But the fact is that we are really lazy when it comes to commenting our code. It is what we do after we code and we often tend to skip it. In PHP it is a common practice to comment the return type of a function in the comments above the function by using the @return directive. C-based languages always declare the return type. public static int getInteger(); In PHP it would be public static function getInteger(). If someone from a strong-typed language begins to read PHP code (if there are anyone of those), things can get quite confusing. "Wait, it is supposed to return something, but it clearly says it is a function!" The programmer thinks function = void as this is always used in Java.
For whatever reason, PHP has decided to allow programmers to declare the type of the input parameters to a function with one exception: Data types such as integer, strings, floats, etc. are not allowed. This caused frustration when I thought my PHP code actually was wrong a while ago when I got the error "Argument 1 passed to function() must be an instance of integer, integer given". And for whatever reason, type-hinting is not supported on functions with a return type.
CSS is fun. You wanna do something as simple as vertically center something? Then you probably have to add more HTML and a dozen of CSS properties just to get your object centered. And let's not get into which browser you wanna support or which version of those browser(s). CSS is literary hell. C++ is a standardized language. So is C. This means if you write code in standardized C++ - say C++11, it would be interpreted exactly the same way by every single compiler which supports C++11. Now here comes the fun part: CSS is not even a standard. Your CSS can be interpreted differently on Chrome, Opera and IE. W3C only comes with recommendations for CSS. Let's say you want to write a browser and you want to implement the CSS3 recommendations which W3C has made. Then you find out that Microsoft, Google, Mozilla and Opera has implemented it differently - all of them. After my experience with XPath and Javascript, Chrome didn't bother when I modified an object from an XPath result. Firefox threw an exception when I made changes to an object and IE didn't even support the document.evaluate function.
Web-languages are from a different world. They are easy and they most likely doesn't work the way you expect them to work. There are no standards, and everyone wants to implement a feature different than anyone else because their way is the best and only way to do it. Sure, it is easy to write PHP code. But the amount of documentation required is higher than C#. Self-documenting code is a key-word. It makes me glad to think about that I didn't chose to become a web-developer as I honestly do not understand how web-developers are able to sleep during the night.