Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I used to program in C#, and I want to study C++. Can I study C++/CLI directly before having prior knowledge of the ANSI/ISO C++?
C++/CLI is a language that allows you to write pure managed code. The compiler even has an option for that, /clr:pure. But the code it generates then is not different from the code that the C# compiler generates. There is therefore no point in using that feature, unless you are a die-hard C++ programmer that favors a C++-like syntax.
It is not equivalent to C++ and there's very little in the language that will prepare you to learn native C++. Very basic native C++ constructs like multiple inheritance, RAII and const are either not available or only approximated. Especially the new C++11 additions are not covered at all, not something you ever want to skip when you start out learning C++.
C++/CLI is targeted as an interop language, it makes it very easy to write a managed class wrapper around existing native C or C++ code. Clearly that is no use to you either if you don't yet know what these languages look like.
Only consider using native C++ if that's the language you want to learn. Learning C++/CLI will only confuse you.
You can, but why?
If you want to learn about C++, you better start programming in C++ (without /Cli).
C++/Cli adds a set of complex behavior and managed pointer types that are not really useful outside of writing wrappers between C++ and C#, and ref classes lack some of the major benefits of C++; namely, RAII (deterministic destruction), const, and templates.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
When I started to learn about testing a program, all I learned is to
use a library or package in the same language as the tested program.
For example,
if a tested program is written in Python, its testing program is also written in Python and uses UnitTest class in the python
standard library
if a tested program is written in C++, its testing program is also written in C++ and uses some test library in C++.
I just saw a project where the tested program is written in C++, and
the testing program is written in Python. Instead of making the
Python testing program to call the C++ tested source code, the
Python testing program loads and executes the executable compiled
from the C++ tested program.
General in software engineering, for a project, how is it decided to choose the same or a different programming language to test a program?
Thanks.
I assume that you refer to unit tests, at least in the widest sense.
Normally you will use the same language for testing, just for the sake of simplicity. Using a different language just produces communication overhead between the tests and the tested code.
The only case where using a different language could make sense is when the language of your tested code is especially cumbersome (think Assembler or COBOL) or if you are not familiar with it. But the latter case actually does not count because unit tests and the tested code are normally implemented by the same developers.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Every programming/scripting language that I have heard of is an Object Oriented Programming (O.O.P) language. What are some examples of languages that aren't considered an O.O.P language.
OOP is a paradigm, not language. Some languages like Javascript or PHP can use OOP, but don't need to (they are multiparadigmatic).
Some languages like C# or Java have to use objects, but that doesn't mean the programs need to be Object-Oriented. In that case it is considered bad design, though. There are even antipatterns that describe screwed OOP, although C# supports coding sugar like lambdas or linq that is not OOP.
Some people try to emulate their favorite paradigm in languages that don't support it well. For example, jQuery tries to use functional (or monadic) paradigm and some say it is not a good idea (although the library is very popular).
I recommend this article to get grasp of most popular paradigms and their difference to OOP.
Assembly, C, BASIC, Fortran, Forth, Pascal, Brainf**k, Malbolge, and dozens upon dozens more.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
My company is currently planning on providing our services and UI components in the form of native SDK. What are pros and cons of building the SDK in Swift vs Objective-C?
Note: Our clients who will be integrating our SDK will be either using Swift or Objective-C.
I would highly encourage watching this talk by Jonathan Blocksom: http://realm.io/news/swift-objc-best-friends-forever/
It says:
"Swift and Objective-C work together fairly well, so there are many reasons why you would want to include both in a single project. There may be a handy Swift library that you want to use in Objective-C, or vice versa. If you have a big Obj-C codebase and you want to learn Swift, now would be a good time to do that as well. Swift was built for Objective-C compatibility and also works with C, but not with C++. Many types in Objective-C translate over to Swift fairly well: BOOL to Bool, NSInteger to Int, SEL to Selector, and so on."
In my limited experience, using Objective-C code from Swift is a more common use-case and fairly trivial. Using Swift code from Objective-C is certainly possible, but it has some gotchas: Specifically, check "Alamofire in Obj-C Case Study" in the video.
Alamofire is an HTTP networking library written in Swift, from the creator of AFNetworking: https://github.com/Alamofire/Alamofire
Also, I would encourage you to read the official document: https://itunes.apple.com/us/book/using-swift-cocoa-objective/id888894773?mt=11
I hope that helps.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am having a very strange question, although I am learning OOPS through C++ since last few months. That why there is a need of a construct like class?
There is no need for classes in object-oriented programming. There are lots of languages which do just fine without them: Self, Io, Ioke, Seph, Slate, NewtonScript and ECMAScript have only objects, no classes. Other languages have mixins. Yet other languages have traits. Some languages have classes and mixins, some classes and traits.
The only thing you really need for object-orientation is some way to perform procedural abstraction. That's it. Lambda Calculus is a perfectly fine OO language, in fact, since it has only procedural (well, actually functional) abstraction and nothing else, one might argue that Lambda Calculus is the purest OO language of all.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
i'm thinking on doing an undergrad project on building an interpreter for a simple/rudimentary custom language (perl / C like). I would be be glad if someone could point me in the right direction to start. Most of the books/resources i find are on theoretical implementation of compilers. Are there any resources aimed at interpreters ? i'm thinking of implementing it in C++, but have very little knowledge on the subject of interpreter design, so any pointers to books/references will be appreciated
The parsing of the source code is not very much different between a compiler and an interpreter. And that is what most textbooks on compilers are about.
There are some nice tools now to implement custom languages.
You might want to checkout Xtext in the Eclipse Modelling Package (http://www.eclipse.org) or MPS (http://www.jetbrains.com/mps/), the language workbench of IntelliJ which is freely available.
Both allow you to create languages and provide the tools to generate code from the source and the tooling to help creating the code.
They also create abstract syntax trees which may be directly manipulated, i.e. executed. Then you have an interpreter.
The classical approach would be to use bison/yacc for as a lexer, respectively parser, and many newer tools are currently available like antlr. The output of the parser is then again the abstract syntax tree ready to do interprete or generate code from.
An Incremental Approach to Compiler Construction - it's about creating compilers, but it might be a good starting point to find references from.
I wrote an interpreter for reading and converting logic expressions at Uni. Wrote it in C, Lexx and Yacc which old school Unix and C programmers seem to swear by. Pretty powerful once you get the hang of them, but reasonably steep learning curve I would say.
http://www.lugbe.ch/action/reports/lex_yacc.pdf