Tag Info

New answers tagged

0

I don't think such statistics exists, and if they are, they may not be particularly relevant. Take C# code base: C# is an object-oriented language, but it is not unusual to see code bases full of procedural code written by programmers who has no understanding of object-oriented programming (or understand it as "OOP is when you put the code in methods ...


5

"What are the merits of using the def keyword for both generators and functions?" While they are mechanically different, in practice when I use them they are often effectively the same to me conceptually (I don't think much of calling range() vs xrange()). In terms of understanding what the function is all about quickly though, I agree something is lost ...


0

I would guess it is because it is more Pythonic but what do I know? ;) I don't really think that it matters all that much. It is easier to remember for me because no need to memorize them both. EDIT: The PEP might say, you could investigate there.


1

Generators are functions that evaluate lazily. Given that they are the same thing at base, it makes sense that they would use the same keyword. One option might be to use a comment to identify which is which for a given instance: def some_function(): #This is a function. return 1 def some_generator(): #This is a generator. yield 1


4

Algebraic data types are the way to discuss this. There are three fundamental ways you can combine types: Product. That's basically what you're thinking of: struct IntXDouble{ int a; double b; } is a product type; its values are all possible combinations (i.e. tuples) of one int and one double. If you consider the number types as sets, then the ...


5

Types are not sets. You see, set theory has a number of features which simply don't apply to types, and vice-versa. For instance, an object has a single canonical type. It may be an instance of several different types, but only one of those types was used to instantiate it. Set theory has no notion of "canonical" sets. Set theory allows you to create ...


2

A type is a description of a category/range of values, compound structures, or what have you. OOPwise, it is akin to an "interface". (In the language-agnostic sense. The language-specific sense, not so much. In Java, for example, int is a type, but has no relation to an interface. Public/protected field specifications, as well, are not part of an ...


2

Sorry but I don't know about the "raw" theory. I can only provide a practical approach. I hope this is acceptable at programmers.SE; I'm not familiar with the etiquette here. A central theme of OOP is information hiding. What the data members of a class are, exactly, should be of no interest to its clients. A client sends messages to (calls methods / ...


30

Neither. I take it you're asking whether having the same set of field types is enough to classify as being the same class, or whether they have to be named identically as well. The answer is: "Not even having the same types and the same names is sufficient!" Structurally equivalent classes are not necessarily type-compatible. For instance, if you have a ...


6

It's not exactly clear what you are asking. You can always prove a program correct, if you want. This is independent of the language. The question is, can you get the computer to do the proof for you, or at least check a proof given by you? And the answer is: Yes! In fact, the Curry-Howard-Isomorphism states that there is an isomorphism between logic and ...


2

Some thoughts: The proof doesn't know what you want to accomplish with your code. That's the domain of well-written software requirements. Tests (when used as a description of requirements, as in TDD) are proof of the software requirements, not the software itself. The proof can, and often does, exceed the complexity of the actual program. Proofs, ...


0

Overriding a method is not about reusing the same. The overridden method conceptually remains the same, is supposed to do everithing that the base method does, only it will do it more specificly. This is an important tool of Polymorphism. Lets see an example: You are creating a class hierachy to model animals. You have already written the Mammal base class, ...


1

I think you may be asking about overloading in which case Wait Ha Lee's answer is great. If you are asking about overriding the benefit is that you can give a different implementation then a super class, but any callers of the given method get to be blissfully unaware of the type of object they are dealing with.


0

If you mean overloading, it's an incredibly useful ability in a language. Take, for instance, the ToString method on a double (MSDN). You can call ToString() to use the default format specifier, specify a format string (e.g. ToString("G4")), or even display it in a specific culture (e.g. ToString(CultureInfo.InvariantCulture)). Overloading allows you to ...


4

In addition to Lisp, Smalltalk, Forth, COBOL, and FORTRAN mentioned by others, there's Pascal, Modula, Fortran, PL/I, BASIC, Snobol, and APL, to name some of the more popular languages that were neither descended from nor implemented in C. Early languages were implemented or bootstrapped in assembler. Here's a small family tree of programming languages. ...


4

Don't forget Algol, which has been called a vast improvement over most of its imitators, including C. Both COBOL and FORTRAN came long before C. I've seen a COBOL compiler written in RPG. It's not unusual for a language's first compiler to be written in that language. The first compilation can be done by hand, and the first thing compiled with the ...


1

Lisp and Smalltalk are good examples of such languages who were not descended from C. There was also a programming language named BCPL before C which isn't in use nowadays.


0

SBMM makes programs more deterministic (you can tell exactly when an object is destroyed); For most programmers the OS is non-deterministic, their memory allocator is non-deterministic and most of the programs they write are concurrent and, therefore, inherently non-deterministic. Adding the constraint that a destructor is called exactly at the ...


2

It is called machine description files. These .md files are used to generate a significant part of the C (now C++) code of the back end. BTW, you could also customize GCC using a Lisp-like language: MELT Some documentation is linked from MELT documentation page, and to get a global picture about GCC I strongly recommend taking several hours on the (Indian) ...


2

Learning C or something similar, such as Pascal, may help you to understand how the compiler, linker, and run-time libraries work together, so you can better understand the low level details of computer systems. This was my experience when comparing the output of a C compiler to assembly code. C will not help much with higher level language ideas, which are ...


3

Learning C will only help you in learning languages which are very much like C. But then, what do you gain from you learning them? The further away from C the language you want to learn is, the less learning C will help you. In particular, C is missing a lot of concepts, paradigms and ideas that are present in more modern languages: first-class procedures, ...


0

Fluency should be something to strive for in the language you're using. I'm not sure if you differentiate knowing things exist and memorizing them. When someone says memorize I usually think of exact naming, syntax, etc. To me there is a greater difference between a developer who doesn't even consider to Google a capability of a language/framework to one who ...


2

There are only few cases that I think an only-go-down goto statement might be useful, but all can be done more elegantly via break and switch statements. There is no need for Goto-down statement, in my opinion, and I'm not aware of any mature or experimental programming language with such an ability.


2

I don't know of any [programming] languages that do this; if it's "bad" enough to allow goto at all then it will allow a goto to go anywhere. I seem to recall a scripting language that only searched forward for the target of a goto statement but, sadly, I can't remember which one; it may have been a [very] early version of DOS.


6

Languages, such as COBOL, don't require exotic hardware. The only resources that might run out are staff. But as long as there are money to be earned, people will learn necessary skills. Some companies today are rewriting their systems into more fashionable languages - but hey, I had an offer last year from a bank which seemed to be rewriting from C++ to ...


8

It is naive to assume that more modern languages are somehow preferable to older ones for a given problem domain. Beyond the issues of risk and the immense cost associated with such modernization is the fact that many legacy environments have their own ecosystem, and have evolved symbiotically with it. These solutions are often the best elixir for a ...


2

Concentrate on the problem-to-class path. Prefer grasping concepts and patterns over memorizing class details, because these first are much more portable than the latter. Sure you'll know the details of classes you use on a daily basis, but you'll not be able to keep track of all classes of your (future) framework(s). A house may be defined as consisting ...


3

How are organisations planning to replace dead languages? In ways that are likely business secrets. When I was last working for a bank they were facing 3 issues: They had hired a new Core system programmer once in the last 20 years an all others were retiring The language was more dead than Cobol. The core system was on a mainframe, which are incredibly ...


10

I've been programming professionally for 20 years, and I am still amazed at how much I don't know. My strongest languages are C++ and Perl, and I know the basics of the language extremely well, but then there's STL and Boost which I have to look up all the time, and all of CPAN which I peruse occasionally and am always happy to find someone else has already ...


21

Programmers aren't the limiting resource. Learning a new language is easy compared to all the domain and program-specific stuff you have to learn when starting at a new company, and people move to new companies all the time. You're talking a language with 300 keywords versus a program with hundreds of thousands of functions. It's not even close. Hardware ...


0

Most of my knowledge is in the world, as opposed to in my mind. I mostly do .net. Unlike Telastyn, I probably only have about 20% of what I use regularly memorized. The rest, I know just barely enough that intellisense can pull up the rest that I need, which is just as fast as had I memorized it. That knowledge is what's in the world. Other times, working ...


7

I'm a C#/.Net developper. .Net is HUGE so I don't beat myself up for not knowing all of it inside and out. That said, because I've been focusing on mostly desktop/server business apps for the past few years I'm very familiar with the subset of .Net that solves my typical problems. That's not to say that I don't occasionally discover new gems here and ...


0

Yes, I can tell you off the top of my head probably 80% of the operations are on the things I use day to day. After all, how can you plan to build something if you don't know what your tools are? Though to be fair, I have an exceptional memory.


15

Funny you should ask that. My father is a COBOL programmer. Graduated from college, got a job at a large insurance firm. Worked on the same app for his entire career (the same physical mainframe for 30 odd years of that). Spent the last 4 years remotely teaching a team of new graduates in India how to write COBOL. He retired last year. I wouldn't count ...


1

If you know MATLAB, then this should be the right way for you: Get the page: webread Search the page for the HTML pattern containing your data: strfind Extract the data Compare the data to the last one recorded If changed, notify, else wait until timer runs out and re-run the process


5

It's not entirely clear whether you are talking about the semantics or the pragmatics here. Your question reads more about semantics, but in the comments you say you are asking about pragmatics. I'm going to answer about both. Semantics Pros: simplicity. Why have two concepts when one will do? Cons: none. Pragmatics Pros: simplicity. Again. Cons: ...


1

Performance doesn't matter. Or rather: compared to providing developers the best tool with which they can express and model what they want the computer to do, performance is the easier problem to solve. Types, classes, objects, functions, lambdas - all those concepts help organize your thoughts and your code. At this point, they're all quite unrelated to ...


1

To complete on RemcoGerlich answer from a Linux perspective: download a page using a command like wget or curl or a library like libcurl (which has many wrapping, including for Python, Guile, etc...) compare two files with diff or cmp (or code the simple loop reading them and comparing byte by byte) to notify you about changes: you could send email (e.g. ...


3

It is too vague. But you basically need the following things, and glue them together: A thing that downloads the webpage and saves it to your computer A thing that compares it to the version you downloaded before this one A thing that notifies you about the comparison if a difference was found A thing that runs this whole contraption every x minutes For ...


0

First tell us your operating system. :) You could use all languages. You have to read the html sourcecode of a website (better only the body). Be careful if there are current timestamp and so on. Another solution would be (if supported) reading the RSS feed.


35

Simple generations overview: a language is n'th generation when it's building blocks are bits instructions Abstract operations Domain objects Program Goals Hence even languages as new as Google Go or Apple Swift are still solidly 3rd generation. Regex is a text matching language, which makes it an early 4th generation language. By this definition, 4th ...


84

“nth-generation language” is a buzzword. It is a marketing term. There is no universally accepted definition of what exactly defines the “nth generation” for n > 2. Some people categorize “scripting” languages such as Perl or Python as 4GLs because they are much more high-level than C, while others think the defining characteristics of 4GLs is that they're ...


3

As far as I know, it's simply a question of C++ having this syntax (and it needed some syntax because the language was not strong enough to support implementing new T(); at that time as a library) and then inherited. From memory, Java inherited it from C++, JavaScript picked it up from Java, and so did C#. Since then, it seems to have become pretty standard. ...


2

If in doubt, spell it out. The point of a variable name is so that the meaning of the code is clearer. Unless the abbreviation is very obvious one, then you may as well just use the smallest one possible. Variable names and function names are typically the only bits of human language in the code and so act both as 'landmarks' for the human eye to find ...


-4

You shouldn't abbreviate stuff for the sake of abbreviating stuff, you should do it for your/others convenience, but if you want to then a general rule that I have for abbreviation is if a word is more than four or five letters long then I'll shorten it to the first three significant letters of that word, e.g.: int damagePerSecond; could be abbreviated to ...



Top 50 recent answers are included