Tag Info

New answers tagged

-1

I am Very new to programming and i am Learning C, My Question is: I am learning from book (C Primer Plus: Edition 5 by Stephen Prata) at home. Will i get enough grip over C language if i learn from book and not from teacher. I am not learning it for Job purpose, actually its my hobby and i like programming. I have some friends that know programming and ...


0

An IDE is a choice of taste in many regards. You can use Eclipse for Java, but you can also use it for C and C++, you can even create webpages (dynamic) with eclipse and do the HTML/CSS and Javascript in there. Though you could opt for a more conventional web-editor such as Brackets. (Which has some nifty features). By the way, Swing is not a different ...


3

Well, take on an application that requires two or three hundred UI forms and you might decide that hand-coding them all is a nightmare and wish for a graphical UI designer. Like everything in this game it's a case of the right tools for the right job.


1

The answers so far have mentioned extreme functional languages. If you're looking for something a bit closer to the mainstream, have a look at Boo. Its syntax is heavily inspired by Python, but it's statically typed. Type declarations are required for defining class members, but for variables, method arguments and return types everything can be optionally ...


6

Type inference does exactly this. You do not generally have to declare types, as they can be inferred from usage. However, more complex type systems will still occasionally require explicit type annotations. Your example can be written in Standard ML as fun some_func {bar} = print (Int.toString bar); val foo = {bar = 123}; some_func foo; This uses ...


8

Yes, pretty much everything in the Haskell/ML family does this. Here's a snippet of some relevant Haskell foo = 1 + bar bar = "Not a number :O" main = putStrLn foo No types need to be explicitly annotated, but the error is still caught at compile time. In general we always infer some types in every language. Nothing would require something like int ...


4

.NET already does this; it's called Linq. Linq is basically SQL for object collections. In C#, it looks like this: var q = customers. where(c => c.City == "Montreal"). select(c => c.CompanyName); and in Smalltalk, it looks like this: q := customers where: [ :c | c city = 'Montreal' ] select: [ :c | c companyName ]. or this: ...


0

At least in .NET languages, it's possible to apply an access specifier to an interface. This can be helpful when an some combinations of an assembly's internal classes share common abilities, but those combinations and abilities do not fit a hierarchical relationship. The fact that the abilities do not fit a hierarchical relationship makes it necessary to ...


8

It usually means that any code marked as deprecated is considered old and out of date, or it may have potentially serious issues with performance/conformity to standards/platform-specific issues/security/compatibility/etc..., and that there is probably a better replacement. It is marked as deprecated to indicate that developers writing new code should avoid ...


1

Yes, but… It has been long known that machine code for Von Neumann architecture machines is too "brittle" to reasonably mimic some life-based dataprocessing. As a simple example, if you alter a single bit in a machine instruction, you won't necessarily get something useful, you may very well crash the processor or program. Contrariwise, biological systems ...


2

You can write an interpreter in a compiled language that executes a self-modifying, domain-specific language whose instructions are held in a mutable data structure of some sort. So yes, it's possible. If your question is "can I do it with the original target language using the original compiler," that, too, is possible, if you write a program that writes ...


0

First of all, if by "real AI" you are referring to Strong AI, this is a yet undecided question. That question has some scientific, some ontological, and some religious aspects, and opinions widely differ. What was commonly referred to as AI by software programmers is merely branches of machine learning, or computer science / electrical engineering / signal ...


1

In the old days, languages (often forms of Assembly) used to be designed with instructions specifically set aside for self-mutating code. This means you could easily tell the program to change itself while it's running, which was used for performance improvements. The key word here is "easily", because although this went out of style decades ago, as a ...


0

You should also take a look at X10, which has been around at least 25 years to my knowledge. Back in the day I used to just power deceives on and off, but it has grown to be much more sophisticated since. X10 is a protocol for communication among electronic devices used for home automation (domotics). It primarily uses power line wiring for signaling ...


1

Rather than trying to modify the firmware of devices, and alternative is to harness what is already in place. As you say, a small single-board computer is a good solution. Try a Google search on Arduino. These boards are cheap, and are designed to control lots of IO lines. Programming in C or C++ is the norm and you are working with bare metal - there is no ...


1

This is a quick article about the relationship between APIs and hardware. Generally, if you are accessing hardware directly, you would generally use a C or C++ driver. You might raise the question: how do all the other languages access the hardware? They utilize the C or C++ compiled driver. EDIT: One of the commenters provided a list of high-level ...


0

I'm not saying it's a good thing to do, but this is trivially possible in Python. I can't thing of a good use case off the top of my head, but I'm sure they exist. class Foo(object): def __init__(self, thing): if thing == "Foo": def print_something(): print "Foo" else: ...


1

Other answers have shown how this is a common feature of dynamic object-oriented languages, and how it can be emulated trivially in a static language that has first-class function objects (e.g. delegates in c#, objects that override operator () in c++). In static languages that lack such a function it is harder, but can still be achieved by using a ...


1

I think a pretty important step is to promote a package manager whicih can also manage the version of the language itself. For instance, I use SBT for Scala or Leiningen for Clojure. Both of them let me declare which version of the language I want to use, per project. So it is quite easy to start green projects in the latest version of the language, while ...


0

I believe that is the definition of a "Dynamic" language like ruby, groovy & Javascript (and Many Many others). Dynamic refers (at least in part) to the ability to dynamically redifine how a class instance might behave on the fly. It's not a great OO practice in general, but for many dynamic language programmers OO principles aren't their top priority. ...


5

Be aware that languages change throughout their life, regardless of how well it might be designed up front. Instead of trying to immediately ship the most awesome language on earth, first try to be useful and extensible. A mediocre langauge which I can actually use is worth more than any wonderful programming language that only exists in theory. Consider ...


0

Conceptually, even though in a language like Java all instances of a class must have the same methods, it is possible to make it appear as though they don't by adding an extra layer of indirection, possibly in combination with nested classes. For example, if a class Foo may define a static abstract nested class QuackerBase which contains a method ...


6

Language stability is not a technical decision. It is a contract between the language author and the users. The author advertise a given version as more or less stable. The less stable a language is, the more changes the author can make. Each user interested by the language can decide if he wants to invest time in it to learn new features or develop ...


0

You can do something like this in C# and most other similar languages. public class MyClass{ public Func<A,B> MyABFunc {get;set;} public Action<B> MyBAction {get;set;} public MyClass(){ //todo assign MyAFunc and MyBAction } }


4

It's hard to guess the motivation for your question, and so some possible answers might or might not address your real interest. Even in some non-prototype languages it is possible to approximate this effect. In Java, for example, an anonymous inner class is pretty close to what you're describing - you can create and instantiate a subclass of the original, ...


1

Naive reference counting cannot deal with cyclic data structures, since parts of the data structure will cause other parts to have a reference count higher than zero. On the trivial end, Lisp (in general and Common Lisp in particular) allows you to create read-time cyclic "lists": #1#=(red green blue . #1#) is a never-ending list. They're even useful, in ...


4

You can think of per-instance methods as allowing you to assemble your own class at runtime. This can eliminate a lot of glue code, that code which has no other purpose than to put two classes together to talk to each other. Mixins are a somewhat more structured solution to the same sorts of problems. You're suffering a little from the blub paradox, ...


8

Reference counting is basically never sufficient for managing memory due to cycles. If a language has mutation we can essentially create a structure like ------------------- | | | | Head | Tail | | | | ------------------- | | | | +-------+ | 1 <+ I put way too much effort into this ...


4

You can also do this in Ruby using singleton objects: class A def do_something puts "Hello!" end end obj = A.new obj.do_something def obj.do_something puts "Hello world!" end obj.do_something Produces: Hello! Hello world! As for uses, this is actually how Ruby does class and module methods. For example: def SomeClass def self.hello ...


-1

Environment fragments in Lisp have an undetermined lifetime, most of the LISP implementations need garbage collection to reclaim free run-time store.


6

You asked for any language that provide per-instance methods. There is already an answer for Javascript, so let's see how it is done in Common Lisp, where you can use EQL-specializers: ;; define a class (defclass some-class () ()) ;; declare a generic method (defgeneric some-method (x)) ;; specialize the method for SOME-CLASS (defmethod some-method ((x ...


9

Methods in most (class-based) OOP languages are fixed by type. JavaScript is prototype-based, not class based and so you can override methods on a per-instances base because there is no hard distinction between "class" and object; in reality, a "class" in JavaScript is an object which is like a template for how the instances should work. Any language ...


1

I think that the existing answers are quite good. I would like to elaborate on some aspects that IMO have not been stressed enough. In mathematics a function is just a mapping from a tuple of values to a value. So, given a function f and a value x, f(x) will always be the same result y. You may well replace f(x) with y everywhere in an expression and ...


1

Patterns will emerge from good Design (SOLID Principles) and continuous Refactoring. If the first thing you'd like to do is implementing patterns, you will utterly fail. Regarding your programming language question, Java would be well suited for pattern usage, with C++ and Smalltalk being equally good matches. You can also make heavy use of patterns in C#, ...


2

The number of patterns used in a code is not a quality metric, often quite to the contrary. Patterns are used to describe best practices to solve common problems, they are a means to reach a goal, not a goal in itself. So what you are asking is which language has most of the common problems to be solved by design patterns. Pick the language best suited to ...


8

Many of the Gang of Four Design Patterns are really just workarounds in Object Oriented languages for mechanisms that are already available in Functional languages. Consequently, the best languages for design patterns (from a productivity standpoint) are the ones that don't require them. If you don't need the pattern, then you don't have to spend any time ...


-1

IMO the term itself references the specification; namely that the specification is released under an open-source license. This is distinct from the implementation, as well as from the development ownership of the language. This makes the Wikipedia article you link to a very very confusing article, as it talks about implementation not specification. For ...


4

The term "open source programming language" doesn't make much sense. The specification of a language can be released under an open source license (for example, the specification of Go uses CC-BY), but many languages listed on that Wikipedia article that are widely used in open source projects don't use an open source license for their specification (e.g. ...


1

It says it right there on the Wikipedia page that you reference: Open-source programming languages are those that are released under open-source licenses.


5

Usually you cannot choose a language per job. There just isn't enough time to learn it, master it, and do the same for its packaging techniques, its ecosystem of available modules and programmers, its debugging quirks, and so on. To say nothing of the economics of investing in tools, learning, and ramp-up time. So usually language choices are based more on ...



Top 50 recent answers are included