Is C# development effectively inseparable from the IDE you use?

I’m a Python programmer learning C# who is trying to stop worrying and just love C# for what it is, rather than constantly comparing it back to Python.

I’m caught up on one point: the lack of explicitness about where things are defined, as detailed in this Stack Overflow question. In short: in C#, using foo doesn’t tell you what names from foo are being made available, which is analogous to from foo import * in Python — a form that is discouraged within Python coding culture for being implicit rather than the more explicit approach of from foo import bar.

I was rather struck by the Stack Overflow answers to this point from C# programmers, which was that in practice this lack of explicitness doesn’t really matter because in your IDE (presumably Visual Studio) you can just hover over a name and be told by the system where the name is coming from. E.g.:

Now, in theory I realise this means when you’re looking with a text editor, you can’t tell where the types come from in C#… but in practice, I don’t find that to be a problem. How often are you actually looking at code and can’t use Visual Studio?

This is revelatory to me. Many Python programmers prefer a text editor approach to coding, using something like Sublime Text 2 or vim, where it’s all about the code, plus command line tools and direct access and manipulation of folders and files. The idea of being dependent on an IDE to understand code at such a basic level seems anathema. It seems C# culture is radically different on this point. And I wonder if I just need to accept and embrace that as part of my learning of C#.

Which leads me to my question here: is C# development effectively inseparable from the IDE you use?

19

Visual Studio is so convenient that after working with it for a while it is difficult to use a different IDE. It has a lot of handy tools and a bunch of plugins available, so practically it has every feature you would need.

On the other hand, whatever language you learn, it is recommended to use command line at the beginning, so you can better understand how it works. C# isn’t an exception.

is C# development effectively inseparable from the IDE you use?

Theoretically no, but practically yes. It is possible to write in C# using a text editor and command line, but if you have Visual Studio, you’d never do this. In fact very few programmers have ever executed C# code from command line.

BTW If you feel inconvenient with using foo, you can use the whole path when using a type.

9

The idea of being dependent on an IDE to understand code at such a basic level seems anathema.

It is not a question of understanding your code: given sufficient time, you can always locate the right variable with a basic text editor or even in a printout. As far as understanding the code goes, the IDE dependency absolutely does not exist.

Locating your references efficiently is an entirely different subject: I love the ability to find usages of Java variables in Eclipse as much as I love finding declaration points in Visual Studio, for both C# and C++. I prefer spending my time coding, rather than looking for declaration points manually. This is similar to doing math: I can multiply multidigit numbers on a piece of paper, but I prefer using calculator to save myself a minute or two.

Starting at a certain “critical size” of the code, a good IDE becomes very useful regardless of the programming language. The size may vary language to language, but once you cross several thousand lines, having an IDE helps regardless of your language. This has more to do with limitations of a human mind than with a particular programming language: at some point, your short-term memory is bound to “overflow”.

There are tricks letting you increase that critical size where IDE becomes useful. For example, you could follow a naming convention (Hungarian names were big in the C++ world at some point, especially among the Windows practitioners). Another common trick is qualifying instance variables with this. even in contexts where such qualification is not required.

These tricks come with trade-offs: almost inevitably, they make your program less readable by obscuring names, or inserting the explicit references the encapsulation was intended to hide. Faced with the choice, I pick clean-looking code plus an IDE over a less-clean-looking code minus an IDE. I fully recognize, however, that other people’s choices may differ from mine.

10

Many Python programmers prefer a text editor approach to coding, using something like Sublime Text 2 or vim, where it’s all about the code, plus command line tools and direct access and manipulation of folders and files.

That’s great, but it misses the point of the VS IDE. The point of an IDE like VS is rapid development support via strong code tools like refactoring and intellisense. VS is a very very good editor for C# code.

Now C# lets you code in a style that depends on its IDE to a greater extent (you can use lots of var keywords and the like). Some people prefer to be more explicit, for instance by using namespace aliases to be clear on which namespace a class belongs to (like import in Java or Python). That’s more of a coding style choice than a feature of the language.

As C# is statically typed (although with some dynamic extensions, as of v4) it’s always fairly easy to find out what types are being referred to – if they’re wrong the code won’t compile, and VS isn’t the only IDE with support for C# intellisense. It’s probably the best though.

Developing C# without a powerful IDE (like VS) is rather like hammering in nails by hand when you already have a top of the range nailgun – there might be the odd time you need to do it, but professionals use the right tool for the job.

I’d say the same is probably true of Java too. If there’s a powerful IDE with intellisense and code refactor tools out there you should probably be using it.

However, look at it the other way round – if you don’t want intellisense, compile time code checking and code-analysis/refactoring then a bloated IDE is not the way to go, and neither is a statically typed language. I think it’s the other way round:

Many programmers that prefer a text editor approach to coding don’t gain as much from statically typed languages (like C# and Java) and so could be better off if they stick to dynamic ones like Python and Javascript.

I think:

  • Dynamic languages suit lightweight tools (heavyweight IDEs confer less benefit here)
  • Static languages suit powerful IDEs (tools can help with the code at the cost of flexibility)

1

To answer your question: although it’s slowly changing, the Microsoft development environment has largely been a monoculture.

This approach has many positives and negatives, which could be argued at length (e.g. consider the pros and cons of open and closed platforms, such as PCs vs an Xbox), but at the end of the day, the tooling from Microsoft is what most people use. The company has also shown that their decision making is often a kind of “give the most value to the majority of our users” process, always looking for practical compromises (most recently – consider Typescript). So basically, I wouldn’t be surprised to find that the development of C# was / is done with the tooling (VS) in mind.

2

Anyone bother to read way down here??

I summarize by saying the massively complex IDE functionality is indispensable and it will (should) evolve to the Zen of Sublime VimNess some day….

Our software is 129 projects of about 2M LOC. Add in the massiveness of the .NET framework and given this all I can say is the IDE is vital, transcending the motivations of this thread’s question.

Insight into the Code Base

Period. You know the kinds of features we’re talking about; except that its convenience becomes indispensable and essential with the kind of code base I deal with.

I write better code because of the IDE. I always add custom messages to my Nunit tests because it’s easy, fast and accurate. I favor enumerations over strings due in large part to intellisense. I do not hesitate to use descriptive/long naming – a multi-line statement is composed fast and clean.

But even this smartness is too much at times. I often use good-old “find in files” text searching.

Coding help

Here is where I oft cry “enough!”. Imagine a screen-full with a dozen colors of mostly obscureatta, some particular variable highlighted everywhere, brace highlighting obscuring what the brace actually is, squiggly underlining everywhere because “it” wants me to write literature not code, icons for Resharper context menus (you just gotta click it! then ignore it most of the time), a signature help popup spanning 2/3 of the screen horizontally, vertically displaying several overloads, a popup because of where you just happened to leave the mouse cursor…. I cant even seen the &^!% line*s* of code I’m working on!

Vis.Stud. needs to embrace minimalism so I can focus on coding and not go through hundreds (thousands if you count every color coding setting and all those plugins) of settings in a losing battle to reclaim sanity. A “Pareto” key would be great.

1

For one, C# is not Python.. There are different design methodologies.

Now, to answer your question, it’s completely possible to use your Python-esque using statements.

using FooBar=MyName.Foo.FooBar; 

It’s just it is definitely not the norm because it’s not nearly so easy. However, I think you should worry less about knowing exactly where exactly each class is coming from. I don’t understand the entire point of doing it this way in Python though.

And also, C# is a language that lends itself very well to using IDEs to make it easier. Intellisense is amazingly simple to implement, especially compared to dynamic languages such as Ruby and Python. However, you don’t have to be stuck to your IDE. I’ve heard of people using Eclipse. There also is of course MonoDevelop(which I use quite a lot), and you can even work from a command line. On my server sometimes, I’ll be editing C# files with vi and then using xbuild to rebuild it… It’s just that using an IDE makes things much easier compared to the command line for typical cases.

My understanding was that in Python, “everything’s public” or something to that effect. In C#, the module designer decides what is public and what isn’t, so when you do an import you only get the public API anyway. That could be a reason for the difference you’re describing.

2

is C# development effectively inseparable from the IDE you use?

At my previous job I was mostly using vim to code in languages such as C#, JavaScript, Powershell, Perl, C++, and quite a few developers used to do something similar. The project was just too big for Visual Studio.

That said, most C# developers deal with much smaller projects and are quite happy to use VS.

This is an interesting view on C# development. What you are asking goes beyond C# though, if you’re asking about the IDE.

Like you say, in Python, you can use various editors to write your code. You can do that with the .NET framework too. There are also other IDE tools you can use such as SharpDevelop. Visual Studio is very tightly co-developed with the .NET framework and is relatively expensive. Tools such as SharpDevelop and the “Express” versions of VS exist to entice more developers to use .NET. Essentially all an IDE does for you is provide an organised environment, usually with intellisense, add-ons for productivity and a “helper” to assemble what can end up being a very scary looking command-line to pass to your compiler. The same is true for Java, tools such as Eclipse just provide the organisation and productivity enhancements for us. Under the hood, nothing magical happens until you build or compile your project and that respect, all IDE’s are just pretty faces to the unfriendly compiler.

When you talk about the “using” statement in C# and compare it to Python, it’s not really the same thing going on under the hood. The using statements are used by the compiler to aid it’s effort in transforming the C# code into MSIL. In MSIL, there is no “import all these classes from this namespace” directive. By the time code is at MSIL level, all the classes have been tagged with their fully qualified names. These “using” and “import” statements are to aid human readability. They are not compiler optimisation commands. After all this initial “tagging of fully qualified names” has gone on, there might be a kind of low-level “minify” to the FQNs but this is to aid the compiler/interpreter to execute faster. This is the optimisation – but there is no control of this offered to the developer, unless you are writing your own custom version of the compiler!

One final fundamental difference between all these languages mentioned on here are that some of them are interpreted by VMs, some are interpreted JIT style and some are fully compiled. How these using directives are implemented across those compilers and interpreters differs greatly.

HTH.

1

I think that historically the answer is pretty much, yes – getting C# development up and running effectively in anything outside of Visual Studio, Xamarin, or SharpDevelop was just too much an unpleasant experience.

But recently a lot of projects have emerged that makes it easier, e.g.:

OmniSharp, provides a foundation for intellisense and refactoring, along with vim, emacs, atom, and sublime plugins. I haven’t actually used it, so I don’t know how well it works, but it does look promising.

Yeoman ASP.NET MVC generators, helps bootstrap a new MVC project (maybe other generators exist).

paket, an alternative to NuGet where you can actually add NuGet packages to your project from the command line, and have your .csproj files updated (although there was a NuGet command line tool, actually updating projects to use the packages was part of the IDE integration, not command line tools).

Paket has the implication that you have to adapt your source code to using it – so if you sit as the single member in a team and wants to use a text editor for coding, and everybody else uses Visual Studio, you would have to convince everybody else to adapt the solution to your needs 🙁

So you should be able to get up and running, but there is comparably more work to do to get your toolchain up and running efficiently.

Not anymore:

http://www.omnisharp.net/

OmniSharp is a family of Open Source projects, each with one goal – To
enable great .NET development in YOUR editor of choice.

It’s fun to say Cross Platform .NET. But is it reasonable for someone
to develop .NET without Visual Studio and Windows?

Is it fun to do .NET on a Mac in Sublime? Ubuntu and Emacs? Windows
and Atom? You can use your editor PLUS get to use great features like
Intellisense (not just Autocomplete), Add Reference, Format Document,
and lots more. Develop anywhere, deploy anywhere (and to Azure!)

I have tested this with subime3 and osx

More samples at

http://blog.jonathanchannon.com/2014/11/12/csharp-first-class-citizen-sublime-text/

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật