Spaces in Paths

A number of readers have recently written me about an error they see when attempting to compile or execute an application or script in books such as, C++ All-In-One for Dummies, 3rd EditionBeginning Programming with Python For Dummies, Python for Data Science for Dummies, and Machine Learning for Dummies. Development environments often handle spaces differently because they’re designed to perform tasks such as compiling applications and running scripts. I had touched on this issue once before in the Source Code Placement post. When you see an error message that tells you that a file or path isn’t found, you need to start looking at the path and determine whether it contains any spaces. The best option is to create a directory to hold your source code and to place that directory off the root directory of your drive if at all possible. Keeping the path small and simple is your best way to avoid potential problems compiling code or running scripts.

The problem for many readers is that the error message is buried inside a whole bunch of nonsensical looking text. The output from your compiler or interpreter can contain all sorts of useful debugging information, such as a complete listing of calls that the compiler, interpreter, or application made. However, unless you know how to read this information, which is often arcane at best, it looks like gobbledygook. Simply keep scanning through the output until you see something that humans can read and understand. More often than not, you see an error message that helps you understand what went wrong, such as not being able to find a file or path. Please let me know if you ever have problems making the code examples in my books work, but also be sure to save yourself some time and effort by reading those error messages. Let me know if you have any thoughts or concerns about spaces in directory paths at John@JohnMuellerBooks.com.

 

Programming Your Way

I’ve been working with Python for a while now. In fact, I’ve worked on three books on the topic: Beginning Programming with Python For Dummies, Professional IronPython, and Python for Data Science for Dummies. Of the languages I’ve used, Python actually comes the closest to meeting most of the programming needs I have (and a lot of other developers agree). It’s not a perfect language—no language can quite fulfill that role because of all the complexities of creating applications and the needs developers have. However, if any language comes close, it’s Python.

There are a number of reasons why I believe Python is a great language, but the issue I’d like to discuss today is the fact that you can actually use four completely different programming styles with Python. Care to guess what they are? In order to find out for sure, you’ll need to read Embracing the Four Python Programming Styles. Before I encountered Python, I never dreamed that a language could be quite so flexible. In fact, the single word description of Python is flexible.

Realistically, every language has potential issues and Python has them as well. For example, Python can run a bit slow, so I probably wouldn’t choose it to perform low level tasks on a specific system. It also lacks the User Interface (UI) functionality offered by other languages. Yes, there are a huge number of add-on libraries you can use, but nothing quite matches the drag and drop functionality provided by languages such as C#.

However, negative points aside, there aren’t any other languages that I know of that allow you so much flexibility in programming your way. You have four different styles to choose from. In fact, you can mix and match styles as needed within a single application. The ability to mix and match styles means that you can program in the way that feels most comfortable to you and that’s a huge advantage. Let me know what you think about Python’s ability to work with different programming styles at John@JohnMuellerBooks.com.

 

Understanding the Continuing Need for C++

I maintain statistics on all my books, including C++ All-In-One for Dummies, 3rd Edition. These statistics are based on reader e-mail and other sources of input that I get. I even take the comments on Amazon.com into account. One of the most common C++ questions I get (not the most common, but it’s up there) is why someone would want to use the language in the first place. It’s true, C++ isn’t the language to use if you’re creating a database application. However, it is the language to use if you’re writing low-level code that has to run fast. C++ also sees use in a vast number of libraries because library code has to be fast. For example, check out the Python libraries at some point and you’ll find C++ staring back at you. In fact, part of the Python documentation discusses how to use C++ to create extensions.

I decided to look through some of my past notes to see if there was some succinct discussion of just why C++ is a useful language for the average developer to know. That’s when I ran across an InfoWorld article entitled, “Stroustrup: Why the 35-year-old C++ still dominates ‘real’ dev.” Given that the guy being interviewed is Bjarne Stroustrup, the inventor of C++, it’s a great source of information. The interview is revealing because it’s obvious that Bjarne is taking a measured view of C++ and not simply telling everyone to use it for every occasion (quite the contrary, in fact).

The bottom line in C++ development is speed. Along with speed, you also get flexibility and great access to the hardware. As with anything, you pay a price for getting these features. In the case of C++, you’ll experience increased development time, greater complexity, and more difficulty in locating bugs. Some people are taking a new route to C++ speed though and that’s to write their code in one language and move it to C++ from there. For example, some Python developers are now cross-compiling their code into C++ to gain a speed advantage. You can read about it in the InfoWorld article entitled, “Python-to-C++ compiler promises speedier execution.”

A lot of readers will close a message to me asking whether there is a single language they can learn to do everything well. Unfortunately, there isn’t any such language and given the nature of computer languages, I doubt there ever will be. Every language has a niche for which it’s indispensable. The smart developer has a toolbox full of languages suited for every job the developer intends to tackle.

Do you find that you really don’t understand how the languages in my books can help you? Let me know your book-specific language questions at John@JohnMuellerBooks.com. It’s always my goal that you understand how the material you’ve learned while reading one of my books will eventually help you in the long run. After all, what’s the point of reading a book that doesn’t help you in some material way? Thanks, as always, for your staunch support of my writing efforts!

 

Coding Schools and the Learning Process

There are three essential ways to begin a career as a developer. The first is to get a college degree in the subject, which is normally a Bachelor of Computer Science or a Bachelor of Information Technology (amongst other degrees). The second is to teach yourself the trade, which means spending a lot of time with books and in front of your screen working through online tutorials. The third is a new option, coding school. The third option has become extremely popular due to limitations in the first two techniques.

The cost of a college education has continued to skyrocket over the past few decades until it has started to elude the grasp of more than a few people. I’ve read estimates that a college degree now costs between $20,000 and $100,000 in various places. How much you actually pay depends on the school, your personal needs, and the electives you choose. The point is that many people are looking for something less expensive.

A college education also requires a large investment in time. A four year degree may require five or six years to actually complete because most people have to work while they’re going to school. A degree is only four years when you can go full time and apply yourself fully. Someone who is out of work today and needs a job immediately can’t wait for five or six years to get a job.

Teaching yourself is a time-honored method of obtaining new skills. I’ve personally taught myself a considerable number of skills. However, I’m also not trying to market those skills to someone else. My self-taught skills usually come in the areas of crafting or self-sufficiency (or sometimes a new programming language). The problem with being self-taught is that you have no independent assessment of your skills and most employers can’t take time to test them. An employer needs someone with a proven set of skills. Consequently, self-teaching is extremely useful for learning new hobbies or adding to existing (proven) skills, but almost valueless when getting a new job. In addition, few people are actually motivated enough to learn a new skill completely (at the same level as a college graduate) on their own.

Coding schools overcome the problem with self-teaching because they offer proof of your skills and ensure you get a consistent level of training. You get the required sheepskin to show to employers. They also address deficiencies in the college approach. The time factor is favorable because most of these schools promise to teach you basic development skills in three months (compared to the five or six years required by a college). In addition, the cost is significantly less (between $6,000 and $18,000). So, it would seem that going to a coding school is the optimum choice.

Recently people have begun to question the ability of coding schools to fulfill the promises they make. It’s important to consider what a coding school is offering before you go to one. The schools vary greatly in what they offer (you can see reviews of three popular code schools at http://www.mikelapeter.com/code-school-vs-treehouse-vs-codecademy-a-review/). However, there are similarities between schools. A coding school teaches you the bare basics of a language. You don’t gain the sort of experience that a college graduate would have. In addition, coding schools don’t teach such concepts as application design or how to work in a team environment. You don’t learn the low-level concepts of how application development works. I don’t know if building a compiler is still part of the curriculum at colleges, but it was one of my more important learning experiences because I gained insights into how my code actually ended up turning switches on and off within the chips housed in the computer.

I see coding schools as fulfilling an important role—helping those who do have programming skills to build competence in a new language quickly. In addition, a coding school could provide an entry point for someone who thinks they may want a computer science degree, but isn’t certain. Spending a short time in a coding school is better than spending a year or two in college and only then finding out that computer science isn’t what the person wants. Coding schools could also help people who need to know how to write simple applications as part of another occupation. For example, a researcher could learn the basic skills require to write simple applications to aid in their main occupation.

People learn in different ways. It’s the lesson that readers keep driving home to me. Some people learn with hands on exercises, some by reading, and still others by researching on their own. Coding schools can fulfill an important role in teaching computer science, but they’re not even close to a complete solution. In order to get the full story about computer science, a student must be willing to invest the required time. Until we discover some method for simply pouring information into the minds of people, the time-consuming approach to learning must continue as it has for thousands of year. There really aren’t any shortcuts when it comes to learning. Let me know your thoughts about coding schools at John@JohnMuellerBooks.com.

 

Beta Readers Needed for Beginning Programming with Python For Dummies

I’m starting a new book project entitled, Beginning Programming with Python For Dummies. Python is a really neat language and it’s used for all sorts of commercial tasks. The main benefits of using Python are that the code is succinct, it’s easy to read, and it’s easy to learn.

This book is intended for someone who has never written any code before. The focus of the book is to make things simple and easy to understand, so if you’re already a Python developer, you probably won’t find too much in the way of new information. Here is a list of the topics you’ll find in my book as you read:

 

  • Part I: Getting Started
    • Chapter 1: Talking to Your Computer
    • Chapter 2: Getting Your Own Copy of Python
    • Chapter 3: Interacting with Python
    • Chapter 4: Writing Your First Application
  • Part II: Talking the Talk
    • Chapter 5: Storing and Modifying Information
    • Chapter 6: Managing Information
    • Chapter 7: Making Decisions
    • Chapter 8: Performing Tasks Repetitively
    • Chapter 9: Dealing with Errors
  • Part III: Performing Common Tasks
    • Chapter 10: Interacting with Modules
    • Chapter 11: Working with Strings
    • Chapter 12: Managing Lists
    • Chapter 13: Collecting All Sorts of Data
    • Chapter 14: Creating and Using Classes
  • Part IV: Performing Advanced Tasks
    • Chapter 15: Storing Data in Files
    • Chapter 16: Sending an Email
  • Part V: Part of Tens
    • Chapter 17: Ten Amazing Programming Resources
    • Chapter 18: Ten Ways to Make a Living with Python
    • Chapter 19: Ten Interesting Tools
    • Chapter 20: Ten Libraries You Need to Know About


As you can see, this is a really useful book for the novice. By the time you complete this book, you’ll be able to perform some useful tasks with Python and you’ll be able to read other books without the usual head shaking and complete frustration. The goal isn’t to turn you into an expert, but to reduce the learning curve so that you can actually follow other texts that you might want to use.

This isn’t a platform specific book. It doesn’t matter whether you work with a Mac, Linux, or Windows. I’m looking for people from all walks of life and my only expectation is that you know how to perform essential tasks with your platform of choice, such as install applications and work as an administrator on that system.

Of course, I still want to avoid making any errors in the book if at all possible. That’s where you come into play. The biggest complaint people have about computer books is that they’re obviously written by an expert and not the people reading them. I take all of the input from the beta readers to avoid that sort of problem. In addition, beta readers often find errors that other people miss. In short, you’re an incredibly important part of the writing process.

As part of being a beta
reader, your name will appear in the book Acknowledgements (unless you
specially ask that I don’t provide it). However, one of the bigger
benefits to you is that you get to read the book free of charge and gain
the skills that it can provide for you. Imagine what learning a new
programming language can do for your career. Even if you don’t need Python
for work, you can use what you gain to create applications for your own
needs and to obtain a better understanding of how computers work. Just contact me at John@JohnMuellerBooks.com if you’d like to work with me on this project.

 

Discovering a New Way to Create JavaScript

Over time, developers will gain an entire toolbox full of different computer languages. A fully stocked toolbox is a developer’s best defense against the ever changing tide in what’s popular and what’s not in the world of application development. Recently I learned about a new computer language called TypeScript. The amazing thing about TypeScript is that it’s a true superset of JavaScript. If you know how to write JavaScript, you already know a great deal about TypeScript. In fact, I wrote an article entitled, “TypeScript: A New Direction in Browser-Based Applications” that describes some of my experiences with this new language. The short story is that TypeScript compiles into JavaScript, so you start with TypeScript and its advantages and end up with JavaScript code that is ready for use in your favorite Web application.

Of course, the biggest question people ask me is why I need to know yet another language.  After 28 years I’ve collected knowledge of more than a few computer languages—some of which turned out to be turkeys, some of which were extremely useful for a limited time, and others that I still use almost daily. Experiencing new languages and understanding how they can make developers more productive helps keep computer science alive for me. If I had stayed with the original set of languages that I learned as part of my training in college, I would not only be bored to tears, I’d be unemployed. So, if nothing else, learning about TypeScript is an adventure for me.

Adventures are better when they’re productive and interesting. TypeScript is interesting because it actually does improve on a language that’s really popular. You gain the advantages of using a compiler and static typing (amongst other things). For me, the use of the compiler is the biggest advantage because working with a compiler makes it possible to locate and fix the sort of simple errors developers make when tired. There have been more than a few times where a seemingly simple problem has kept my JavaScript application from running as it should and I later found that the problem was something that a compiler would have found in an instant.

Finding mistakes fast and easily, especially when you’re tired, is a real productivity booster. If I can code efficiently for another hour or two because I have a compiler helping me, I can produce more usable code than other developers. In the end, no one is going to care that I used a compiler to produce my JavaScript code. All that anyone is going to care about is that I produced more lines of code in a given time-frame than other developers using older techniques that don’t involve using a compiler. When you use TypeScript, you gain a productivity advantage over other developers.

TypeScript is available using the Node.js Package Manager, a Visual Studio plug-in, or by compiling the source code for your particular environment. My personal favorite is the Node.js Package Manager because it lets me work at the command prompt without having to worry about a particular IDE. I simply set up Komodo Edit to work with the new environment. Since I already use Komodo Edit to create my JavaScript applications, the environment is a good fit with TypeScript as well. There is no actual TypeScript support in Komodo Edit now, but people are talking about it. Of course, you’ll have your favorite environment and working with a new language like this always presents some challenges at first.

If you do try TypeScript out, let me know what you think of it. Do the features that TypeScript provides today make working with a new language worthwhile? Let me know your thoughts at John@JohnMuellerBooks.com. Also, keep your eyes peeled for more posts about TypeScript because this really does seem like an interesting and productive language!

 

Debugging As an Educational Tool

One of the questions I get asked quite often is how I learn new programming techniques. After all, I work with a broad range of languages and IDEs in my pursuit of new programming environments. Let’s face it—I like to play with code. For me, it’s not really a job to write application code. I like to see how different things work and what’s possible with a given language. In order to accomplish my goals, however, I need to learn techniques quickly. The debugger is my secret to learning how to code quickly and easily. In fact, I’ve written an article on the topic, “Improve Your Coding Skill by Listening to the Debugger.” You also see this technique emphasized in a number of my books, especially LINQ for Dummies and Start Here! Learn Microsoft Visual C# 2010 Programming.

The main reason that I use the debugger as an educational tool is that I can see the code in action. It’s possible to see how the code actually works, rather than envision what the code is supposed to do. The difference is important. For me, seeing the code actually work demonstrates that the theory behind the code is sound. Many theories sound good until you actually try to use them—using the debugger proves the theory as you work through the code.

From a personal perspective, the biggest hindrance that I face in using the debugger as an educational tool is the lack of good comments. In fact, comments are such a problem that I write about them in Creating Useful Comments. When the code lacks comments, I need to look up the calls myself and then determine how the developer is using them. It’s time consuming and a somewhat painful way to learn at times because I can see the code work, but I don’t know how it works or why the developer chose a particular approach. Even worse is when the code contains misleading comments. Worse still are comments that are outright incorrect because they reflect a previous state of the code or the developer didn’t actually understand why a technique works (the sheer dumb luck approach to coding).

Make sure you check out my article on the topic and get back to me about it. I’d like to hear your views on using the debugger as an educational aid. For that matter, I’d like to hear your viewpoint on debuggers as a class of application. Do you feel they need work or are debuggers as useful as they need to be? You may even feel that debuggers have become encumbered by way too many features. Whatever your viewpoint, let me know at John@JohnMuellerBooks.com.

 

Methods of Learning

More than a few readers write me about the best way to learn. Many of them are asking about the best way to learn how to become a programmer—a topic I discuss in my Becoming a Programmer post. However, more and more often, readers are asking me about learning in general. The fact is that I can point you to different techniques for learning, but I can’t determine what will work best for you. You’re the only person who can make that determination and you won’t know until you try a number of techniques. In a society ever more devoted to success at all costs, learning requires that you fail in order to make gains. When you fail, you learn what doesn’t work and possibly why it doesn’t work. So, trying various techniques is the only way to discover what works best for you and that process involves some level of failure.

I imagine that my answer frustrates a lot of people because they don’t want to fail at something, so they ask what works best for me. Mind you, what works for me probably won’t work for you. I personally learn best by working through examples written by other people. When it comes to programming, I rely on application examples written by other developers and scrutinize them intensely using the debugger so that I can see precisely how they work. Then I create applications of my own that use those techniques to ensure I actually do understand how things work. Likewise, I use examples from other woodworkers, gardeners, or other professionals as a basis for my own hands on learning experiences. In addition to these hands on techniques, I also read a large number of books and articles every year. Often, all I really need to learn a new technique, is a good explanation of it. I read books and magazines in every area that interests me—everything from application development and computer hardware to new gardening techniques and animal husbandry. In some cases, I also attend lectures and seminars to augment my learning, but given that lectures and seminars tend to be expensive, I focus on my primary means of learning new things whenever possible.

Don’t limit yourself to what I use though. There are many other ways of learning that are just as viable and just as important. The only requirements of learning is comprehension (the ability to understand what you’ve learned) and retention (the ability to remember what you have learned). How you achieve your goal is up to you. Here are a few other methods you might consider trying in addition to those that I commonly use.

 

  • Instructor Led Training: There is a good reason that children go to school. An instructor (teacher) can answer questions about a particular skill immediately and fully. The interactive communication that occurs helps the student learn faster and with fewer problems.
  • Tutorials: A tutorial is essentially a set of precisely written procedures meant to guide the student along a particular learning path. It’s a combination of reading and doing that helps someone develop a skill quickly.
  • Interactive Media: This is a newer form of the tutorial that relies on sight and sound to convey meaning. Interactive media includes animations and graphics that help a viewer visualize the content better. Hands on exercises included with the interactive media help the student know when a particular training goal is achieved.
  • Observation: The subtle art of observation isn’t mentioned very often anymore—probably because people are too busy or impatient to use it. I know that I’ve learned more than one new task though simply by watching someone else do it. Observing someone means watching and thinking about what they’re doing. You don’t necessarily ask any questions (and may annoy the person you’re observing when you do).
  • Experimentation: Of all of the methods used to learn, this method provides the highest gains when successful, but also incurs the greatest amount of failure. It’s a matter of asking a question, deciding on how best to answer that question, and then creating an environment in which to determine the answer. In order to ensure that the question is answered correctly, you often have to repeat the experiment a number of times in various environments. Experimenters often discover new knowledge or rediscover lost knowledge, but at the cost of failing a lot.
  • Cooperation: A cooperative learning environment is one in which two peers have part of an answer and choose to share their part with someone who has another part of the answer. The exchange benefits both parties because both now have two parts of the answer. Of course, a cooperative learning environment requires trust on the part of both people.
  • Dissection: When I was younger, I couldn’t be bothered to keep anything in one piece. I dissected everything in an attempt to discover how it worked. Often, that meant not putting the item back together because the dissection process is destructive. Even so, you’d be amazed at how many things you can learn by dissecting an object to see how it’s put together.


This list is incredibly short. Over the years I’ve seen people learn an amazing array of knowledge using all sorts of techniques that boggle the mind. In every case, the successful learner has experimented with various techniques until he or she finds the techniques that work best. These techniques won’t work best for someone else, but they work best for you. I encourage you to fail in order to learn. Don’t be afraid of trying something and then discovering it doesn’t work because that’s the only real way to learn anything. Let me know about your favorite learning technique at John@JohnMuellerBooks.com.

 

Configuring Visual Studio for IronPython Use

Last week I discussed a small bit of information I left out of my book in the procedure that begins on page 26 (see Professional IronPython Chapter 2 Step-by-Step Procedure Update for details). It turns out that the small bit of information isn’t the only thing you need to worry about with that procedure. A reader wrote in to mention that the basic settings you choose can also make a difference. If you have Visual Studio configured for Web Development, the procedure won’t work. That’s because of the way Visual Studio treats Web development. The problem is that you won’t have a solution (.SLN file) to save. I encountered this problem once before, but forgot about the issue until the reader wrote to me. Use the following procedure to check your settings:

  1. Choose Tools→Import and Export Settings. You’ll see the Import and Export Settings Wizard dialog box shown here.
    VisualStudioSetup01
  2. Choose Reset All Settings and click Next. The wizard will ask you to save your current settings as shown here. It’s always a good idea to save your settings before even looking at the configuration.
    VisualStudioSetup02
  3. Click Next. You’ll see the Choose a Default Collection of Settings page shown here. This is where the problem lies. I normally choose General Development Settings because I work in a lot of different languages. If your dialog box shows that Web Development is selected, then the procedure won’t work.
    VisualStudioSetup03
  4. Choose a setting other than Web Development (I highly recommend the General Development Settings as being the most versatile) and click Finish. Visual Studio will reconfigure itself for whatever settings you chose. This change will make it possible to save the project solution file for the examples in Professional IronPython.

 

If anyone encounters any other problems with this procedure, please be sure to let me know at John@JohnMuellerBooks.com. I’m always happy to hear from readers about issues regarding my books and want to make things as easy as possible for you.

Professional IronPython Chapter 2 Step-by-Step Procedure Update

Every once in a while, a small error gets past me that really is almost microscopic, yet ends up causing readers woe. Errors of this sort (or any sort at all) are the reason I wrote the Errors in Writing post so long ago. In this case, there is a small mistake in Professional IronPython that might not seem like such a big deal at first, but it has caused problems for readers, so I’m providing an update here.

In Step 7 on page 26 I ask you to choose File→Save All, after which, you’re supposed to see the dialog box shown in Figure 2-4. It turns out that the step doesn’t quite work and for an important reason. Back in step 4 I asked you to right click the IPY entry in Solution Explorer. Of course, that step highlights IPY, selecting it. As a consequence, step 7 can’t work as written because you can’t save IPY.

To make Step 7 work as printed in the book, first highlight the Solution ‘ipy’ (1 project) entry in Solution Explorer (see Figure 2-2). Selecting this entry means that you’re asking Visual Studio to save the solution, not IPY. Now when you choose File→Save All, you’ll see the Save File As dialog box shown in Figure 2-4 as expected.

Please let me know if you encounter any other errors of this sort and I’ll be more than happy to discuss them in my blog. For this, and any other book-related concerns, contact me at John@JohnMuellerBooks.com.